Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
Follow up #40
  • Loading branch information
minamijoyo committed Jan 20, 2022
1 parent ea91dff commit 7ad2382
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
10 changes: 7 additions & 3 deletions command/test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ func setupTestAcc(t *testing.T, providerName string, providerVersion string) {
if err != nil {
t.Fatalf("failed to get current dir: %s", err)
}
os.Chdir(workDir) // nolint: errcheck
if err := os.Chdir(workDir); err != nil {
t.Fatalf("failed to change dir to %s on setup: %s", workDir, err)
}

t.Cleanup(func() {
os.Chdir(oldDir) // nolint: errcheck
if err := os.Chdir(oldDir); err != nil {
t.Fatalf("failed to change dir to %s on cleanup: %s", oldDir, err)
}
os.RemoveAll(workDir)
})

Expand All @@ -73,7 +77,7 @@ func setupTestWorkDir(source string) (string, error) {
return "", fmt.Errorf("failed to create work dir: %s", err)
}

if err := os.WriteFile(filepath.Join(workDir, "main.tf"), []byte(source), 0644); err != nil { // nolint: gosec
if err := os.WriteFile(filepath.Join(workDir, "main.tf"), []byte(source), 0600); err != nil {
os.RemoveAll(workDir)
return "", fmt.Errorf("failed to create main.tf: %s", err)
}
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ func copyOutput(r io.Reader, doneCh chan<- struct{}) {
wg.Add(1)
go func() {
defer wg.Done()
io.Copy(os.Stdout, r) // nolint: errcheck
// nolint: errcheck
// We should check for errors here, but haven't done yet.
io.Copy(os.Stdout, r)
}()

wg.Wait()
Expand Down
6 changes: 5 additions & 1 deletion tfschema/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ func newGRPCClientConfig(pluginMeta *discovery.PluginMeta, options Option) *plug
Logger: options.Logger,
AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC},
Managed: true,
Cmd: exec.Command(pluginMeta.Path), // nolint: gosec
// nolint: gosec
// G204: Subprocess launched with a potential tainted input or cmd arguments.
// The path of executable was found in plugin directories,
// which means it has a valid terraform plugin name.
Cmd: exec.Command(pluginMeta.Path),
AutoMTLS: true,
VersionedPlugins: tfplugin.VersionedPlugins,
}
Expand Down

0 comments on commit 7ad2382

Please sign in to comment.