]> Cypherpunks repositories - gostls13.git/commit
cmd/go: improve error message for missing import starting with cmd/
authorJay Conrod <jayconrod@google.com>
Tue, 6 Aug 2019 16:44:30 +0000 (12:44 -0400)
committerJay Conrod <jayconrod@google.com>
Tue, 6 Aug 2019 23:05:55 +0000 (23:05 +0000)
commite37a1b1ca6afcbe3b02d2dfd599ad1d3d926ec34
tree12a89f90d95122135803b6bd06a970bbbacf3057
parent0ed86cda677f04a9ca01498dfa9722f234f984d2
cmd/go: improve error message for missing import starting with cmd/

In modload.Import, confirm that the import path does not start with
"cmd/" before calling QueryPackage, which returns a less helpful
error.

In load.loadPackageData, don't wrap errors with "unknown import path".
The wrapped error should always include the import path, and it's also
repeated in the PackageError wrapper.

Fixes #31031

Change-Id: I071efa22e3842c62831d096f888a8006811fe724
Reviewed-on: https://go-review.googlesource.com/c/go/+/189157
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go.sum
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/modload/import.go
src/cmd/go/testdata/script/cmd_import_error.txt [new file with mode: 0644]