You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I imported a path that was not a valid package (because of a combination of build tags, test files, documentation package files, and/or no files present, but was a valid path to a directory on a filesystem (one which contained (an)other package(s)). go build ./... and go test ./... and go mod tidy report an error in finding the path to the package within the module.
and after the module was pushed to a repository (github.com/johnrichardrinehart/a) instead of (github.com/a, as in the gist):
johnrinehart@modie test (master) $ go mod tidy
go: finding github.com/johnrichardrinehart/a/folder latest
github.com/johnrichardrinehart/a/folder/pkg imports
github.com/johnrichardrinehart/a/folder: no matching versions for query "latest"
The text was updated successfully, but these errors were encountered:
bcmills
changed the title
Output details for importing a non-package path
cmd/go: clarify error message when importing a package that could be (but isn't) in the main module
Sep 24, 2019
Implementation-wise, this should probably be encoded as a special case of PackageNotInModuleError for Mod == Target, with a corresponding special case in its Error method.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
What did you do?
I imported a path that was not a valid package (because of a combination of build tags, test files,
documentation
package files, and/or no files present, but was a valid path to a directory on a filesystem (one which contained (an)other package(s)).go build ./...
andgo test ./...
andgo mod tidy
report an error in finding the path to the package within the module.What did you expect to see?
I guess it would have been nice to see (both) 2 things output (as @Helcaraxan and @thepudds have suggested in Gophers slack (#modules):
What did you see instead?
Before the module was pushed to a GitHub repository (everything local)
and after the module was pushed to a repository (
github.com/johnrichardrinehart/a
) instead of (github.com/a
, as in the gist):The text was updated successfully, but these errors were encountered: