Merge pull request #24122 from hashicorp/alisdair/unlock-commentary

command: Comment to explain why unlock is required
This commit is contained in:
Alisdair McDiarmid 2020-02-14 17:04:47 -05:00 committed by GitHub
commit 678760b61a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -97,6 +97,7 @@ func (c *ConsoleCommand) Run(args []string) int {
// Get the context
ctx, _, ctxDiags := local.Context(opReq)
// Creating the context can result in a lock, so ensure we release it
defer func() {
err := opReq.StateLocker.Unlock(nil)
if err != nil {

View File

@ -204,6 +204,7 @@ func (c *ImportCommand) Run(args []string) int {
// Get the context
ctx, state, ctxDiags := local.Context(opReq)
// Creating the context can result in a lock, so ensure we release it
defer func() {
err := opReq.StateLocker.Unlock(nil)
if err != nil {