Open rsc opened 3 years ago
Ping from the release team: any updates on this release blocker?
Briefly looked into this, but wasn't able to reproduce it. Outside a module in 1.17.1, I see this:
$ go build notexist.go
no required module provides package notexist.go: go.mod file not found in current directory or any parent directory; see 'go help modules'
Inside a module:
$ go build notexist.go
no required module provides package notexist.go; to add it:
go get notexist.go
What version of Go was this? What does go env
show?
@bcmills This is in the 1.18 milestone; time to move to 1.19? Thanks.
(The current error isn't great since it treats nonexist.go
as the name of a package. That is technically correct but maybe if it doesn't exist we can treat a trailing ".go" as a special case and give a different error message.)
Whoops, sorry, didn't mean to close this.
This was improved somewhat by the fix for #48907, but it's still not ideal.
This also turns out to be another in the cluster of go list -e
error-reporting bugs. There are a number of base.Fatalf
calls in load.GoFilesPackage
that could just as easily be returned as errors.
Change https://go.dev/cl/386496 mentions this issue: cmd/go: improve error handling for nonexistent files
For what it's worth, I'm not in /Users/rsc/go/src. That's just the error looking for a std package named notexist.go. It should show me an error more like 'no such file notexist.go'.
/cc @bcmills @jayconrod @matloob