]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go: clean up adding import path to command error
authorAustin Clements <austin@google.com>
Wed, 11 Oct 2023 16:15:57 +0000 (12:15 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 19 Oct 2023 12:23:49 +0000 (12:23 +0000)
commitab5bd15941f3cea3695338756d0b8be0ef2321fb
treee8c7f0632a2385346caa6a508d184c6929176a8f
parent9299547e4dec01a7fed8226f8d3080eccf965aa4
cmd/go: clean up adding import path to command error

Currently, cmdError makes a somewhat fuzzy attempt to ensure the
package import path is part of the printed error, using a string
prefix check. Also, if it decides it does need to add the import path,
it prints it as a "go build" line, which could be misleading because
it can happen outside of "go build".

Clean up the whole code path by explicitly checking the provided error
description against Package.Desc(), and instead of emitting "go build"
in the error message, print it as "# importPath" just like we do in
the common case.

Change-Id: Idb61ac8ffd6920a3d2d282697f4d7d5555ebae0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/534655
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/cmd/go/internal/work/exec.go
src/cmd/go/testdata/script/list_pkgconfig_error.txt