]> Cypherpunks repositories - gostls13.git/commit
go/internal/srcimporter: add context to cgo errors
authorBryan C. Mills <bcmills@google.com>
Mon, 18 Apr 2022 17:12:43 +0000 (13:12 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 20 Apr 2022 15:44:57 +0000 (15:44 +0000)
commit17f8d98a4adf8386e63a0d2902ff42ca5e80996e
treefcc5f878c26c4d20a03c680d14986b59be5ed414
parentcbc9e589053e7339c1e3c4d6e88c6c015792efce
go/internal/srcimporter: add context to cgo errors

An error message like "could not import os/user (exit status 1)"
(observed in https://go.dev/issue/52407) is fairly inscrutable.

On the other hand, srcimporter doesn't report errors with quite enough
structure to dump the entire stderr output from 'go tool cgo' without
potentially overwhelming the caller. Here, we split the difference by
describing which command failed but not printing the output of that
command.

For #52407, that would at least provide a stronger clue connecting
to #52408.

Change-Id: Iabdc95b17ba20a0f6ff38e5c7084e5081e1ef5e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/400817
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/go/internal/srcimporter/srcimporter.go