From 37d2484cc8ab9bfdf20d379ae8b92505f48e624e Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Wed, 2 Nov 2022 14:16:32 -0400 Subject: [PATCH] Satisfy linter --- sdk/go/auto/remote_workspace_test.go | 23 ++++++++++++----------- sdk/go/common/resource/plugin/context.go | 13 +++++++------ sdk/go/common/resource/plugin/plugin.go | 3 ++- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/sdk/go/auto/remote_workspace_test.go b/sdk/go/auto/remote_workspace_test.go index 0929828edb88..55ee3192ba54 100644 --- a/sdk/go/auto/remote_workspace_test.go +++ b/sdk/go/auto/remote_workspace_test.go @@ -23,23 +23,24 @@ import ( func TestIsFullyQualifiedStackName(t *testing.T) { t.Parallel() - tests := map[string]struct { + tests := []struct { + name string input string expected bool }{ - "fully qualified": {input: "owner/project/stack", expected: true}, - "empty": {input: "", expected: false}, - "name": {input: "name", expected: false}, - "name & owner": {input: "owner/name", expected: false}, - "sep": {input: "/", expected: false}, - "two seps": {input: "//", expected: false}, - "three seps": {input: "///", expected: false}, - "invalid": {input: "owner/project/stack/wat", expected: false}, + {name: "fully qualified", input: "owner/project/stack", expected: true}, + {name: "empty", input: "", expected: false}, + {name: "name", input: "name", expected: false}, + {name: "name & owner", input: "owner/name", expected: false}, + {name: "sep", input: "/", expected: false}, + {name: "two seps", input: "//", expected: false}, + {name: "three seps", input: "///", expected: false}, + {name: "invalid", input: "owner/project/stack/wat", expected: false}, } - for name, tc := range tests { + for _, tc := range tests { tc := tc - t.Run(name, func(t *testing.T) { + t.Run(tc.name, func(t *testing.T) { t.Parallel() actual := isFullyQualifiedStackName(tc.input) diff --git a/sdk/go/common/resource/plugin/context.go b/sdk/go/common/resource/plugin/context.go index adb0911e426a..472bfaec3493 100644 --- a/sdk/go/common/resource/plugin/context.go +++ b/sdk/go/common/resource/plugin/context.go @@ -42,7 +42,7 @@ type Context struct { // metadata describing the plugin. DialOptions func(pluginInfo interface{}) []grpc.DialOption - DebugTraceMutex sync.Mutex // used internally to syncronize debug tracing + DebugTraceMutex *sync.Mutex // used internally to syncronize debug tracing tracingSpan opentracing.Span // the OpenTracing span to parent requests within. @@ -88,11 +88,12 @@ func NewContextWithRoot(d, statusD diag.Sink, host Host, } ctx := &Context{ - Diag: d, - StatusDiag: statusD, - Host: host, - Pwd: pwd, - tracingSpan: parentSpan, + Diag: d, + StatusDiag: statusD, + Host: host, + Pwd: pwd, + tracingSpan: parentSpan, + DebugTraceMutex: &sync.Mutex{}, } if host == nil { h, err := NewDefaultHost(ctx, runtimeOptions, disableProviderPreview, plugins) diff --git a/sdk/go/common/resource/plugin/plugin.go b/sdk/go/common/resource/plugin/plugin.go index fd451579d54c..41d887e5ca80 100644 --- a/sdk/go/common/resource/plugin/plugin.go +++ b/sdk/go/common/resource/plugin/plugin.go @@ -168,7 +168,8 @@ func dialPlugin(portNum int, bin, prefix string, dialOptions []grpc.DialOption) return conn, nil } -func newPlugin(ctx *Context, pwd, bin, prefix string, args, env []string, dialOptions []grpc.DialOption) (*plugin, error) { +func newPlugin(ctx *Context, pwd, bin, prefix string, args, env []string, + dialOptions []grpc.DialOption) (*plugin, error) { if logging.V(9) { var argstr string for i, arg := range args {