Go: Fix err being shadowed in RunListWithEnv

This commit is contained in:
Michael B. Gale
2024-05-08 11:56:31 +01:00
parent 724d026238
commit 896fb87d1d

View File

@@ -194,8 +194,8 @@ func RunListWithEnv(format string, patterns []string, additionalEnv []string, fl
out, err := cmd.Output()
if err != nil {
if err, ok := err.(*exec.ExitError); ok {
log.Printf("Warning: go list command failed, output below:\nstdout:\n%s\nstderr:\n%s\n", out, err.Stderr)
if exitErr, ok := err.(*exec.ExitError); ok {
log.Printf("Warning: go list command failed, output below:\nstdout:\n%s\nstderr:\n%s\n", out, exitErr.Stderr)
} else {
log.Printf("Warning: Failed to run go list: %s", err.Error())
}