-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
build: tools with dependency conflicts cannot be built #71192
Comments
See the long discussion in #48429, it was an explicit decision to do this. |
@seankhliao I did read through the long discussion and saw a comparison of current scheme (one version per dependency) and one of not tracking any dependencies (security issue). Was it discussed to track separately like the proposal? I couldn't find it. At the bare minimum, there is still a bug then that Edit: or even more of a really bare minimum, the potential trap needs to be documented. |
it is the same as adding any other dependency. see #48429 (comment) |
I see - given CLI tools have not had to worry about potential API conflicts like this, it is disappointing to see an after-the-fact change where their users may see this breakage using a native Go feature (tools.go was basically a workaround), and that it is as intended. It's particularly sad since it's the maintainers that are going to be the ones that foot the bug reports about compilation failures. But the clarity helps - for my tools, I will go ahead and preface the readmes with |
Go version
go version devel go1.24-39f2032c
Output of
go env
in your module/workspace:What did you do?
https://github.com/anuraaga/hellotools
Add tool dependency on two tools which depend on different versions of the same library, which has an API break in between versions. Because tool dependencies are tracked monolithically in go.mod, it only references the newer version and the tool depending on the older version cannot be built.
When initially using the
tools.go
pattern back in the day, I had to give up on it for this reason and stick togo run foo@ver
in build scripts to avoid conflicts between them. Ideally withtool
now a native feature of Go, it could be smarter than collapsing all the dependencies into one, but admittedly this will probably be a large change needing a proposal for something like namespace'drequire
. Until it though, I'm nervous to try usingtool
since I may need to migrate back togo run
. Ideallyv0
libraries aren't used in the wild, but in practice especially in CLIs I find they're common.Just random idea
What did you see happen?
What did you expect to see?
Tool builds and runs
The text was updated successfully, but these errors were encountered: