From aa38cbe3bc712c9792c6e7075b36a48938627d98 Mon Sep 17 00:00:00 2001 From: Alisdair McDiarmid Date: Fri, 14 Feb 2020 16:29:07 -0500 Subject: [PATCH] command: Comment to explain why unlock is required --- command/console.go | 1 + command/import.go | 1 + 2 files changed, 2 insertions(+) diff --git a/command/console.go b/command/console.go index 9974fb8e8..81ba3a8a9 100644 --- a/command/console.go +++ b/command/console.go @@ -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 { diff --git a/command/import.go b/command/import.go index 96e35fb35..5996040d8 100644 --- a/command/import.go +++ b/command/import.go @@ -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 {