-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
✨ Go modules support #414
✨ Go modules support #414
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: DirectXMan12 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
b795f19
to
dd63d2f
Compare
dd63d2f
to
34fd251
Compare
bcc0136
to
18e722c
Compare
gopkg.in/inf.v0 v0.9.1 // indirect | ||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect | ||
gopkg.in/yaml.v2 v2.2.1 // indirect | ||
k8s.io/api v0.0.0-20190222213804-5cb15d344471 |
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.
Do we want to use replace
to pin specific versions of k8s deps? k/k uses replace
to pin all deps, btw.
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.
IIUC k/k uses replace
to make the staging
directory work.
Unlike k/k, controller-runtime always uses a published version of k8s deps.
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.
Using it for staging
is part of the reason I think. They use it to pin specific versions for all dependencies. Anyway, just wanted to make sure if we want to force specific k8s versions for a given c-r release or just let minimum version selection do its thing.
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.
I have been playing with Go mod. It seemed to me that until k8s.io supports go mod, you have to pin using replace to pick up the correct version. So, to set dependency on k8s.io 1.14.x we are using replace.
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.
replace only works on the highest-level repository, so when people consume this repo, replace won't help them.
Also, these should be kubernetes-1.14.x -- if you say "k8s.io/api kubernetes-1.14.x", go mod tidy
will convert it to a version-ish thing like this, but it still should be equivalent afaict (check the date on the commit -- it should match the corresponding version from Gopkg.toml)
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.
Yep, go mod tidy
will convert to a "pseudo version". Also, your point about downstream consumers of this library makes sense. Thanks for clarifying.
@@ -25,6 +25,14 @@ if [ -n "$TRACE" ]; then | |||
set -x | |||
fi | |||
|
|||
(go mod edit -json &>/dev/null) |
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.
Quoting the help text: "The -json flag prints the final go.mod file in JSON format instead of writing it back to go.mod."
What is the purpose of this? Just printing?
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.
I think it's just a handy way to check if modules is enabled for the repo, given the next line grabs exit code.
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.
yep, exactly! I'll add a comment.
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.
(note that we're using the command's return code immediately below :-) )
why this is a problem when using go modules? |
@mengqiy I think that's because Go mod authors recommend not to use From https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies:
|
18e722c
to
fb24791
Compare
fb24791
to
7b06d5b
Compare
eef34c5
to
85f88c2
Compare
This should be fine, as long as minimal version selection holds and you don't call `go get -u` on other direct dependencies.
85f88c2
to
6bcefa6
Compare
It's a maintained, non-archived version of gometalinter that's also faster.
Now based off the go.mod file.
6bcefa6
to
5fde62f
Compare
/lgtm |
This should be fine, as long as minimal version selection holds and you
don't call
go get -u
on other direct dependencies.