remove race from closed-over err variable

This commit is contained in:
James Bardin 2020-04-08 10:12:46 -04:00
parent 85593b432e
commit b84e6f7f95
1 changed files with 2 additions and 3 deletions

View File

@ -364,7 +364,7 @@ func (c *LoginCommand) interactiveGetTokenByCode(hostname svchost.Hostname, cred
}),
}
go func() {
err = server.Serve(listener)
err := server.Serve(listener)
if err != nil && err != http.ErrServerClosed {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
@ -417,8 +417,7 @@ func (c *LoginCommand) interactiveGetTokenByCode(hostname svchost.Hostname, cred
return nil, diags
}
err = server.Close()
if err != nil {
if err := server.Close(); err != nil {
// The server will close soon enough when our process exits anyway,
// so we won't fuss about it for right now.
log.Printf("[WARN] login: callback server can't shut down: %s", err)