-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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/go: "leading dot in path element" for previously-undiagnosed paths in go 1.13 #34992
Comments
Leading dots have been disallowed in module and package paths from the very start of module mode, in Go 1.11. (See https://golang.org/cl/124378.) The major change in Is there reason to believe that |
in go.1.12 |
Is We made several changes to the code that resolves package paths to modules, and the error checking is more aggressive than it used to be. I wonder if we're reporting an error there instead of simply disqualifying |
That's not the behavior of I believe that part of the purpose there is to prevent the creation of “hidden packages” (since dotfiles are hidden in many platforms) in the user's module cache, |
It's a directory in the dependency and the |
If it's a directory within the dependency, then Do |
we use |
If |
Ok I just tried.
now
|
Does Bear in mind that |
I got
|
Let's say we have an internal module that has I wonder if this is true for all the other github projects, that they're all enforced to not have |
@xytan0056, again, such a path has never been allowed in module mode. Is there reason to believe that this was ever a common pattern for packages buildable with the |
@bcmills I understand. Surprised that it's disallowed all this time. It works when we were in package mode. I'm trying to make it work in module mode.
I'm confused. Is it possibly because I have the same module prefix as my dependency?
|
Update: It looks like go 1.13 example
All of the above succeeds on go1.12 with What is the recommendation for generated code with leading dots in general? |
@xytan0056 Thanks for investigating and publishing those repositories. It looks like go1.13 does not check import paths all the time. It reports this error when looking up a module for an imported package that is not provided by any module. In this case, there is no module that provides I think this error is correct, and actually we ought to be reporting it in more changes. However, I don't think we should make a change like that without understanding how many people that will break, especially at this point in the freeze. We could improve the error message though. It should say
Avoid leading or trailing dots in path names. Generated code is generally fine. It should just be checked into a directory that follows these rules.
|
@jayconrod Is there anything to do for this issue for the 1.14 release? Any doc updates? |
@ianlancetaylor I think we just need to clarify the wording in an error message. Doesn't need to go into the release notes. |
Moving milestone to backlog. |
Our project does not have this problem with |
@liasece, please file a separate issue with steps to reproduce (but first see the changes to defaults described at https://tip.golang.org/doc/go1.16#go-command). |
Unfortunate decision, that I also noticed now in go 1.16 rc1. Oh well, I'll learn to live with it I guess. |
Barring any surprising new information, this behavior of the |
Change https://golang.org/cl/297530 mentions this issue: |
Change https://golang.org/cl/297634 mentions this issue: |
Change https://golang.org/cl/297912 mentions this issue: |
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
OutputWhat did you do?
upgrade from go1.12.9 to go1.13 in bazel WORKSPACE
run
go mod tidy
What did you expect to see?
finish successfully
What did you see instead?
our monorepo setup
Does go 1.13 scan code of dependency's import path and check for dots as well?
The text was updated successfully, but these errors were encountered: