-
Notifications
You must be signed in to change notification settings - Fork 2.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
Switch to Go 1.12 & replace dep by go mod #868
Conversation
da51f0d
to
0f9304e
Compare
How much effort would it be to switch to 1.12? It brings some new improvements in memory management which may be (very) useful for us: https://golang.org/doc/go1.12#runtime. |
@GiedriusS I'll take a look 👍 |
So I've just downloaded 1.12 and it builds as it with my branch. So I guess we just need to change the golang version in circle-ci. |
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.
Thanks for this! It's generally LGTM, just:
- I am not entirely sure if everyone is fine with dropping
deps
, especially if someone imports Thanos (e.g prom-operator): https://kubernetes.slack.com/archives/CFFDS2Z7F/p1551230319073800 - Can we ensure we import exactly the same tags/commit versions? Just to make sure this change will not introduce any changed in logic in our deps. I know it might be tedious.. but worth it.
E.g recent change in minio broke one user's workflow... We might want to slowly upgrade deps using our dependabot integration instead. What do you think?
You mean dropping FWIU go mod tries to honour versions specified in the FYI information I tried hard to compile Thanos with a soon to be merged prometheus patch (prometheus/prometheus#5009) which will enlarge the dependency tree of projects importing prometheus and I couldn't make it work with |
@domgreen as per discussion on K8s slack: |
We need rebase as well |
Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
OK I will, should we jump directly to go 1.12 ? |
Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
We can, I don't think that matters much. Can we add something to docs? Like this? https://github.com/prometheus/prometheus/blob/master/CONTRIBUTING.md#dependency-management (we can literally copy all) |
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.
How does running make
go for you? I get an error on gocheck
:
go: launchpad.net/gocheck@v0.0.0-20140225173054-000000000087: bzr branch --use-existing-dir https://launchpad.net/~niemeyer/gocheck/trunk . in /home/domgreen/go1.12/pkg/mod/cache/vcs/f46ce2ae80d31f9b0a29099baa203e3b6d269dace4e5357a2cf74bd109e13339: exec: "bzr": executable file not found in $PATH
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.
As above ... need to think more about making people to install bzr
This might be needed ... in discussions.
Shamelessly copied from https://github.com/prometheus/prometheus/blob/master/CONTRIBUTING.md#dependency-management Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
After talking with the amazing @myitcv it turns out that with mod the requirements graph that is generated means that the transitive dependencies need to be pulled from the It turns out that the dependency in question is actually a dep of Lets add this to our documentation that if you see this error you will need to install |
|
Can we add a check in make that the user has bzr installed and tell them to install it for deps if not as well as in the contributing docs. |
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.
👍
Only changes that I would like:
- run
make
to ensure all formatting and deps are up to date (locally I had a file with formatting changes) - check for bzr install prior to doing
mods
- add info to CONTRIBUTING about need of
bzr
- remove
make dep
andmake vendor
go mod tidy
and fail build in CI if git diff is not as expected.
Another pro tip from @myitcv is that we should do Will update the request for change above to reflect this. |
Whether or not you choose to commit a |
Thanks, @myitcv good to have an experienced go modder 🤘 take a look over this. @sylr have just checked locally we can replace the need to use So can we refactor the Locally I think |
Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
@myitcv I've just one question about |
@domgreen I prefer to keep |
Modules neither touches nor uses Modules use the read-only modules cache (which happens to be located at
So
Can you explain what you think |
After removing the |
@myitcv All right, it seems I've been really misunderstanding the internals of go mod. I'll clear all |
Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
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.
Few nits but nearly there... doesnt matter if it takes a while longer we need to ensure we keep the quality of the project high :)
Also, did you run make
locally? I'm still getting modifications to main_test.go
after running make
.
Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
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.
Amazing thanks for the hard work.
I rm -rf $GOPATH
and ran make
and all worked perfectly. 👍
* Switch to Go 1.11 & replace dep by go mod Signed-off-by: Sylvain Rabot <s.rabot@lectra.com> * Use Go 1.12 Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr> * Add a few lines about go mod in CONTRIBUTING.md Shamelessly copied from https://github.com/prometheus/prometheus/blob/master/CONTRIBUTING.md#dependency-management Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr> * feat: add a vendoring check Signed-off-by: Sylvain Rabot <s.rabot@lectra.com> * fix: specify the need for git & bzr to be installed Signed-off-by: Sylvain Rabot <s.rabot@lectra.com> * Remove unneeded go mod vendor Signed-off-by: Sylvain Rabot <s.rabot@lectra.com> * Fix formatting Signed-off-by: Sylvain Rabot <s.rabot@lectra.com> * Check that git and bzr are present Signed-off-by: Sylvain Rabot <s.rabot@lectra.com> * Add bzr download link Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
The latest release of Thanos is still built with go 1.11 I think:
Does the CI system need to change? |
Follow up of #602.
CC @domgreen