-
Notifications
You must be signed in to change notification settings - Fork 41
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
Move tool dependencies to a submodule #38
Conversation
Codecov Report
@@ Coverage Diff @@
## master #38 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 123 123
=========================================
Hits 123 123 Continue to review full report at Codecov.
|
Not sure how the CI break is related, but Go 1.11 is quite an old version. |
Ping @abhinav |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! Thanks for the contribution and apologies for the delay. This is a reasonable change. @prashantv and I considered doing this originally but found that renaming to tools_test.go
was good enough for at least the go mod vendor
case. However, it sounds like these constraints are still a problem, so we are in favor of moving tools dependencies to a submodule.
Would you mind rebasing on master so that we have a green build?
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I suspect tools_test.go can now be called tools/tools.go
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
30c92e1
to
55bab6e
Compare
@abhinav rebased and renamed. Thanks! |
Can you also cut a release once it's merged? |
Renaming tools.go to tools_test.go isn't enough. These constraints are still carried over to consumers. Renaming only drops them from `go mod vendor`. This moves tools dependencies to a `tools` submodule which we will never publish. Ref uber-go/multierr#38
Thanks! Yes, we'll cut a release when this is merged. I see that we still have an /x/tools dependency which is coming from uber-go/atomic. |
@sagikazarmark can you clarify how this issue is manifesting for you? For example, I just did:
Following this, the
And if we run
|
Dependencies are added to See for example https://github.com/emperror/errors/blob/master/go.sum |
Ah! Yes, this seems accurate. Tried locally with the same example as before:
That includes test dependencies too. CC @prashantv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks for the additional context @sagikazarmark
Looking at the documentation for go mod download
, it's not clear this is intentional:
With no arguments, download applies to all dependencies of the main module.
I wouldn't expect test dependencies of a dependency of the main module to be downloaded, I wonder if this is a bug or a feature request to avoid downloading transitive dependencies.
Given the behaviour, and only slightly increased complexity of the solution, I think this makes sense to do.
Renaming tools.go to tools_test.go isn't enough. These constraints are still carried over to consumers. Renaming only drops them from `go mod vendor`. This moves tools dependencies to a `tools` submodule which we will never publish. Ref uber-go/multierr#38
We'll update, merge and release this after uber-go/atomic#80 lands and is released. Thanks! |
Upgrade to atomic v1.7.0, which drops the /x/tools dependency.
Inspired by the Go wiki, but also by Uber's approach: - uber-go/multierr#38 - uber-go/zap#914
Inspired by the Go wiki, but also by Uber's approach: - uber-go/multierr#38 - uber-go/zap#914
Multierr currently brings a bunch of packages as dependencies which are not required for the library itself (lint, license tools, etc).
This PR relocates those tools into a separate Go module, so they are not installed for the consumers of multierr.
The alternative would be just creating a new mod file (eg. tools.mod) and adding the dependencies (without a tools_test.go file)