Skip to content
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

cmd/compile: confusing message when go.mod file and vendor folder both present #44149

Closed
dotaheor opened this issue Feb 7, 2021 · 6 comments
Closed
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@dotaheor
Copy link

dotaheor commented Feb 7, 2021

What version of Go are you using (go version)?

$ go version
go version go1.15.8 linux/amd64
go version go1.16rc1 linux/amd64

What did you do?

package main

import _ "aaa"

func main() {
}

What did you expect to see?

package aaa is not in GOROOT (GOROOT/src/aaa)

What did you see instead?

cannot find package "." in:
	ProjectRoot/vendor/aaa
@seankhliao
Copy link
Member

What exactly did you do, I can't reproduce the issue as described

Also note that names without a dot in the first element are considered reserved for the standard library, using a proper name gives a better error message

» mkdir /tmp/example && cd /tmp/example

» go mod init example.com/foo
go: creating new go.mod: module example.com/foo

» cat << EOF > main.go
package main
import _ "aaa"
func main() {}
EOF

» go build
main.go:3:8: package aaa is not in GOROOT (/home/arccy/sdk/gotip/src/aaa)

» mkdir vendor

» go build
main.go:3:8: cannot find package "." in:
	/tmp/example/vendor/aaa

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Feb 7, 2021
@dotaheor
Copy link
Author

dotaheor commented Feb 8, 2021

You exactly reproduced the error described above.

@seankhliao
Copy link
Member

I don't think it's a problem? Without vendor/ a package with a name like aaa cannot be retrieved by standard tooling so it makes sense to report it as not found in GOROOT. With vendor/, which can be created by other tools, it is possible to use a package named like that

@dotaheor
Copy link
Author

dotaheor commented Feb 8, 2021

OK, but shouldn't the message be

cannot find package "aaa" in:
	ProjectRoot/vendor

package "." confuses people.

@seankhliao
Copy link
Member

that's #38748

@dotaheor
Copy link
Author

dotaheor commented Feb 8, 2021

Looks so. Close it for that.

@dotaheor dotaheor closed this as completed Feb 8, 2021
@golang golang locked and limited conversation to collaborators Feb 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants