Skip to content

Commit

Permalink
Satisfy linter
Browse files Browse the repository at this point in the history
  • Loading branch information
t0yv0 committed Nov 2, 2022
1 parent 59979a1 commit 37d2484
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
23 changes: 12 additions & 11 deletions sdk/go/auto/remote_workspace_test.go
Expand Up @@ -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)
Expand Down
13 changes: 7 additions & 6 deletions sdk/go/common/resource/plugin/context.go
Expand Up @@ -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.

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion sdk/go/common/resource/plugin/plugin.go
Expand Up @@ -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 {
Expand Down

0 comments on commit 37d2484

Please sign in to comment.