Skip to content

Commit d7d2e54

Browse files
acehinnnqrurunqianchen
andauthored
fix(go): use cmd.Output instead of CombinedOutput (#132)
Co-authored-by: runqianchen <runqianchen@bytedance.com>
1 parent 9ee179b commit d7d2e54

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lang/golang/parser/parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func getDeps(dir string) (map[string]string, error) {
162162

163163
cmd = exec.Command("go", "list", "-json", "all")
164164
cmd.Dir = dir
165-
output, err = cmd.CombinedOutput()
165+
output, err = cmd.Output()
166166
if err != nil {
167167
return nil, fmt.Errorf("failed to execute 'go list -json all', err: %v, output: %s", err, string(output))
168168
}
@@ -175,7 +175,7 @@ func getDeps(dir string) (map[string]string, error) {
175175
if err.Error() == "EOF" {
176176
break
177177
}
178-
return nil, fmt.Errorf("failed to decode json: %v", err)
178+
return nil, fmt.Errorf("failed to decode json: %w, output: %s", err, string(output))
179179
}
180180
module := mod.Module
181181
// golang internal package, ignore it.

0 commit comments

Comments
 (0)