-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 #74
Go modules #74
Conversation
Codecov Report
@@ Coverage Diff @@
## master #74 +/- ##
=======================================
Coverage 23.61% 23.61%
=======================================
Files 13 13
Lines 1080 1080
=======================================
Hits 255 255
Misses 813 813
Partials 12 12 Continue to review full report at Codecov.
|
LGTM in general. If you should have any questions regarding the new modules, don't hesitate to ping me. I'll be happy to help (if I can 😉) |
Newbie question - would it be worth an update to |
Nothing should actually change - if anything, things could be removed. Building locally means running There's nothing like |
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.
Builds and tests fine (with or without vendor/).
I think it's ready to merge!
I want to ensure that I come out of this migration without any major change to my workflow. Here's my main requirements:
Is anybody able to give me a run-down on how I could achieve all of these things using go modules? |
|
Okay so @dawidd6 was faster than me :) regarding 3.: Basically, at the end of your This means it will replace all imports of See here for further info. |
I intend on reading that link in the near future but alas I'm having both a busy work week and a busy open source week haha. I've just tried testing this out locally. I've pushed a commit to the master branch of my gocui fork containing a random comment in one of the files, then in lazydocker I've done
Have I missed a step? |
I ran |
Actually I don't know how go mod behaves with vendoring. Regarding the "added /modified a heap", it's hard to say. The diff is too big, but it looks like it updated the vendor-directory? TBH, in the long term, you should try to remove that vendor dir. If you wanna "try out something quickly", you can clone it to some directory and use the |
Looks like I found some nice guidelines on how to update dependencies in vendor/ directory: So to update one dependency (like you did): go get -u <repo url>
go mod vendor |
update: without setting GOFLAGS=-mod-vendor, I can do:
And that pulls in my changes, except that now if I do @dawidd6 I came across that link too but it doesn't really change the overhead I'm gonna be dealing with now. @tommyknows the I do wanna say for the record that I kinda feel like go modules is going to add more cognitive overhead, not less. The fact that most of that overhead is due to using a vendor directory doesn't really change the fact that I didn't really have any issues with the former solution and it looks like the new solution is going to be a bit of a headache, given I can't just set that So just to confirm, is the main reason for doing this that people want to store their code outside the go directory? If so, I can understand the desire to switch, but I just have a very bad feeling that this will make development harder than it needs to be. |
The main reason is that it is the "standard" versioning tool now in Go - and it should (hopefully) be the last one. I don't think that modules are more complicated than the solutions that existed before. I'm interested to know why, apart from vendoring, you think it is more overhead than before? |
just had a look and it appears that in go 1.14 we're gonna be seeing better support for vendor directories: golang/go#30240. So hopefully once that's out this will be much easier, and I can just set an environment variable and forget about it. @tommyknows I sympathise with the appeal of a standard versioning tool but it seems to still have some maturing to do. I also disagree about not needing a vendor directory. Off the top of my head there are three good reasons to use it:
As for the overhead, my previous workflow was:
Now my workflow will be to set
It's not substantially different but for somebody who's tools all revolve around reducing keypress-counts, this does bother me. I'll also need to ensure that goreleaser and ci are properly making use of the vendor directory (which is a set-and-forget thing but even so). And I'll need to communicate to users that I'm not trying to weasle my way out of using go mods: as I said I'm happy to do it for the sake of satisfying the contributors who want it, I'm just flagging that this will indeed incur a cognitive load larger than the previous one. EDIT: turns out you can use GOFLAGS= at the beginning of go get to make it work. That's if you want to set GOFLAGS=-mod=vendor in your rc file, which you likely won't. If you opt against that you'll need to use |
Seems like the main pain point now is that I see your point and tbh I'm mad at go right now, cause looking at it's source, one can see this: It's really strange that So @jesseduffield I think that the best solution to this for you, would be exporting |
@dawidd6 agreed. At least I know what commands I need to run to satisfy my use cases. I'm going to update the contributing.md and then we'll merge this PR :) |
I've updated the cache key in circlci's config.yml to use go.sum rather than Gopkg.lock. Can anybody think of other places we might need changes on CI? Might we need to add a -mod=vendor somewhere in the commands? Also I've noticed that go mod added a heap of random files, like licenses etc. I wonder if they will change the size of the binary much |
Seems that it's a slightly smaller binary with go mod, so that's a plus |
If we want to make use of vendor/ while building on CI, then I think we have to supply an option to The same option as with |
done :) |
We're passing CI! Any last words before I press the button? |
to be honest I have no idea what I'm doing here. I just hope I'm making the right decision 😢 and this doesn't make things harder in the long run