-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: suppress warning messages about symlinks #35941
Comments
It looks like this warning was introduced in CL 46425, long before modules. It's emitted any time a pattern is expanded ( I don't think these warnings should be deleted entirely, but making them less spammy would be good. Not sure how to do that though. Checking for .go files in a symlinked directory is probably not enough, since the directory itself may not have any .go files, but it may have subdirectories that do. I think Kubernetes' |
@jayconrod yeah, I've run into this in the past when doing things like However, I think the spam is more of a problem with modules:
What about suppressing the warnings for |
Suppressing these warnings for |
If they're not appropriate for Given that folks can already explicitly prune out subdirectories using As an alternative, would it make sense to do the |
I explained above why I think it's reasonable to treat these differently, but if we have to treat them the same, then I'd err on the side of no spam.
We have a large monorepo with projects in several languages. Before it was all a single GOPATH with vendored source. I'm converting it to be a single module instead. Adding empty go.mod files to a bunch of project directories just to suppress this warning is probably a nonstarter.
Currently, only sibling (or "cousin" or "cousin Nth removed") directories. I didn't mind ignoring these warnings (or |
Just to add a small point, we have a situation where a Go directory is linked with a symlink. (I know .. I know ..). So removing these warning would certainly help. |
So, could you move the |
There is no single Go source tree. Everything's mixed. What I meant was only that no Go package directory or any descendent thereof contains symlinks.
|
As workaround you can create an empty go.mod file in each directory you want to ignore.
But this is not a perfect workaround because you ignore sub/symlink with this method. See go wiki modules https://github.com/golang/go/wiki/Modules#can-an-additional-gomod-exclude-unnecessary-content-do-modules-have-the-equivalent-of-a-gitignore-file |
@sebd71 as I wrote above:
It's simply not reasonable for us to add lots of go.mod files to non-Go projects, especially in an ongoing way (adding and deleting them as we add and delete symlinks). |
I'm agree with you and that's why I said that it's not a perfect workaround. |
@bcmills @jayconrod would you accept a PR for this once the tree opens? We still haven't migrated our code to modules and this tooling wart is definitely a sticking point. |
Discussed with @matloob, @bcmills offline. It seems like the best thing to do here is only print this warning when there's an explicit argument that has a @cespare Does that work for you? I'd be happy to review a CL for this. We can review any time, but it won't be merged until the tree opens for 1.16. |
Absolutely. Thanks! |
Go commands show a warning message any time a pattern is expanded and a symlink to a directory is encountered. For monorepo with non Go projects using symlinks underneath, the output of go commands could be spammed by this warning. This commit includes the behavior change to only print this warning when there's a pattern containing ... . Fixes golang#35941
Change https://golang.org/cl/311890 mentions this issue: |
I'm converting a large source tree which used vendoring in GOPATH world into a Go module. An issue I've encountered is that
go mod tidy
andgo mod why
print some warnings about symlinks.These look like:
Where a warning line is printed for every symlinked directory in the repo.
These warnings make these 'go mod' commands unpleasant to use (you have to scroll through all the junk to see the relevant bits, if any, at the bottom).
None of the Go code is in symlinked directories. The symlinks are for other projects in other languages. For example, one use of symlinks is as a cheap way to share certain JS/CSS assets between multiple sub-projects.
Would it be possible to simply delete these warnings? Alternatively, could we remove the warning if the symlinked directory doesn't contain any Go code?
I tested this behavior in both Go 1.13.4 and tip (bf3ee57).
/cc @bcmills @jayconrod for cmd/go, and @rsc who originally wrote these warning messages as far as I can tell.
The text was updated successfully, but these errors were encountered: