-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: poor error message from 'go build -mod=vendor' when passing an absolute package path instead of a relative one #38748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I will work on it! |
@bcmills We came across a similar error message in Kubernetes, though I'm not too sure if it's due to the same reason as mentioned in the issue body. Running the following command at the root of https://github.com/kubernetes/kubernetes worked in go 1.13 but fails in go 1.14. kubernetes/test-infra#18200 has more details. The With go 1.14.4:
With go 1.13.12:
|
@nikhita Can confirm, that issue is closely related.
This error is shown when vendor mode is enabled and a package that's not present in the vendor directory is needed. In Go 1.14, vendor mode is enabled when As a work around, you can import |
Without this fix, build errors are seen for some components like node_exporter[1]. Reference: golang/go#38748 [1] https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/openshift_node_exporter/98/pull-ci-openshift-node_exporter-master-images/1471344281665933312 Signed-off-by: Arunprasad Rajkumar <[email protected]>
Is this fixed?
|
When
foo
is a relative subdirectory, the error message fromgo build foo/
seems a lot worse when-mod=vendor
is set than when it is unset:The error message from the first
go build foo/
seems reasonable to me: it clearly indicates thatfoo
was interpreted as a package path, where we expected to find that package, and why we failed to do so.The error message from
go build -mod=vendor foo/
is much worse: it mentions apackage "."
, which has nothing to do with what the user passed in, fails to mentionGOROOT
(which is where a package namedfoo
generally ought to be) at all, and buries thevendor
part in the middle of the file path.CC @jayconrod @matloob
The text was updated successfully, but these errors were encountered: