-
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: tools.go/+build tools dependencies in go.mod not updated with any go get -u variant #32345
Comments
Interesting. I had been wondering about this case. My expectation (or really I guess hope) had been the new You could try to specify the build tag, e.g., That might or might not work, but the more interesting question probably is whether or not the Healthy chance this is related to changes in #26902 (but I suspect you knew that). A related question would be for GOOS and GOARCH. |
Passing a build tag does indeed update the version of
|
I get the same, which sort of makes sense given the tag is what's keeping the directory "sane".
Yes, I read all of the commits and was waiting for that CL specifically to land to retest updating dependencies on all my projects. 😃 |
I know that |
Change https://golang.org/cl/179898 mentions this issue: |
Thanks for reporting this. When loading packages for the purpose of modifying the build list, |
Pulled that CL locally to test, and it does fix my test case. Thanks. I'm not sure how much it matters, but the test case in that CL doesn't quite match the "tools" pattern since |
I updated the test to match this. It shouldn't matter, since we don't check package names when constructing the build list. If we ever consolidate that logic, this would be a good regression test.
This should be okay. |
Do you mean in terms of the test you've written, or my original test case? I know that I need to use -- This is only partially related, but I hope when 1.13 gets released the explanation of the "right" way to update dependencies for a project is noted somewhere. I follow all of the changes here, and it's getting a bit difficult to figure out what variant of |
I'm planning to write a guide for this before 1.13 is out. We clearly need to improve module documentation in a lot of areas, but given the changes to To summarize though, in 1.13,
So |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
No. (1.12.5)
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I use the
tools.go
/+build tools
method with gobin to manage tools within my project. This is a boiled down version of my actual setup:go.mod
:main.go
:tools.go
:Both of the dependencies listed in
go.mod
are outdated (by design).go list
knows about both:And shows their updates (
go list -m -u all
):I want to update both of them, so I try
go get -t -u
,go get -t -u ./...
, or evengo get -t -u all
.What did you expect to see?
Both
golang.org/x/tools
andrsc.io/quote
are updated.What did you see instead?
Only
rsc.io/quote
is updated:In Go 1.12, I can do any of the
go get -u
,go get -u ./...
, orgo get -u all
and have everything update.The only ways I've gotten the dependency to update is to remove the
+build tools
, but that causes the file to error out, as even_
imports ofmain
packages are disallowed. The only way then would be to both have atools.go
file and another dummy package depend on an unrelated non-main package in the dependency (say,golang.org/x/tools/go/analysis
), but that isn't ideal.The text was updated successfully, but these errors were encountered: