-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Go module support #2294
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 module support #2294
Conversation
I know @elcore was working on this in parallel, so tagging him on this. |
There are a lot of unnecessary imports (go mod tidy), and there has to be some changes to our Travis configuration. Furthermore, updating Lego should be a separate PR. |
@francislavoie it's still recommended to keep a vendored copy for now I'll work on tidying and checking the travis config. thanks! |
.travis.yml
Outdated
@@ -5,9 +5,12 @@ addons: | |||
- quic.clemente.io | |||
|
|||
go: | |||
- 1.x | |||
- 1.11.x |
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.
Don't change this
.travis.yml
Outdated
|
||
script: | ||
- gometalinter --install | ||
- gometalinter --disable-all -E vet -E gofmt -E misspell -E ineffassign -E goimports -E deadcode --tests --vendor ./... | ||
- vendorcheck ./... | ||
- go test -race ./... | ||
- go test -mod=vendor -race ./... | ||
|
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.
Add go test -mod=readonly -race ./...
before go test -mod=vendor -race ./...
.travis.yml
Outdated
- go get -t ./... | ||
- go get github.com/golang/lint/golint | ||
- go get github.com/FiloSottile/vendorcheck | ||
- go get github.com/alecthomas/gometalinter |
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.
Keep:
go get github.com/golang/lint/golint
go get github.com/alecthomas/gometalinter
Please reinitialize vendor, remove the whole folder and run |
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.
Now we need to fix Travis
Maybe we should add
to |
I have done some research, it looks like gometalinter is not compatible with modules. (alecthomas/gometalinter#521), we could replace it with https://github.com/golangci/golangci-lint (seems to be compatible with modules) @mholt What do you think? |
@elcore Yes, let's try switching to golangci-lint and see how it goes. :) Lego is also making the switch: go-acme/lego#644 |
771a80a
to
d5661ca
Compare
.travis.yml
Outdated
env: GO111MODULE=auto | ||
- language: go | ||
go: tip | ||
env: GO111MODULE=auto |
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.
We just need 1.x
and tip
with GO111MODULE=on
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'm not so sure. I believe travis will clone this to an old GOPATH
style directory in which case it will use the old way of vendor (https://github.com/golang/go/wiki/Modules#when-do-i-get-old-behavior-vs-new-module-based-behavior).
.travis.yml
Outdated
|
||
before_install: | ||
# Decrypts a script that installs an authenticated cookie | ||
# for git to use when cloning from googlesource.com. | ||
# Bypasses "bandwidth limit exceeded" errors. | ||
# See github.com/golang/go/issues/12933 | ||
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then openssl aes-256-cbc -K $encrypted_3df18f9af81d_key -iv $encrypted_3df18f9af81d_iv -in dist/gitcookie.sh.enc -out dist/gitcookie.sh -d; fi | ||
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then openssl aes-256-cbc -K $encrypted_3df18f9af81d_key -iv $encrypted_3df18f9af81d_iv -in dist/gitcookie.sh.enc -out dist/gitcookie.sh -d; fi | ||
- go get -u github.com/golangci/golangci-lint/cmd/golangci-lint |
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.
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.
That's how I had it originally but the everything else was go get
so I switched it. I'll update it to that. Thx.
.travis.yml
Outdated
after_script: | ||
- golint ./... | ||
- golangci-lint run --deadline=10m --disable-all -E golint -E gofmt -E misspell -E ineffassign -E goimports -E deadcode ./... | ||
- go test $TEST_ARGS -race ./... |
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.
There should be two tests, one with -mod=readonly
and one with -mod=vendor
. Currently, it's only running once (probably with -mod=vendor
, you don't know which one is running)
.travis.yml
Outdated
|
||
after_script: | ||
- golint ./... | ||
- golangci-lint run --deadline=10m --disable-all -E golint -E gofmt -E misspell -E ineffassign -E goimports -E deadcode ./... |
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.
10m sounds very long...
What do you think?
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
Just wondering, what's the status on this @ehazlett? |
@francislavoie sorry for the delay. i'll try to get it rebased and travis working. |
Any updates on this? |
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
Signed-off-by: Evan Hazlett <[email protected]>
This is the direction I want to take our dependency management, but I need to see how this will affect the build server and everyone's third-party plugins who may or may not use modules. Basically I'll have to take some time and do some local testing. I haven't looked in depth yet; but why does the change lose about 70K lines of code? Are the dependencies still vendored so that we don't have to depend on third-party repos? |
In my experience, |
|
correct, i didn't explain the best :). Go mod vendor will only capture that as far as I can tell. In my example, we had vendored in those files as they were needed to generate from the protos however, they are not required to build specifically so Go modules removed it. It looks like the same is happening here (as well as cleaning up some duplicates, i.e. vendor/github.com/lucas-clemente/quic-go/vendor/github.com/bifurcation/mint/syntax/tags.go). @mholt to answer your question, a quick run through of the -191k looks like almost all vendor related. I definitely don't want to cause any issues with third party plugins, etc. To save the headache and time from the maintainers I'm going to close this for now until Go modules come out of experimental. Thanks for the reviews and sorry it was a time sink. |
Thank you for all the work done on this. Thanks to the help in this thread and in #2504, we have completed the move to Go modules. Not 100% sure it's correct, but we'll need to iron that out next. |
First of all, sorry for the patch bomb. Here is a cute picture to lighten the mood :)
1. What does this change do, exactly?
Migrates from gvt to Go modules.
2. Please link to the relevant issues.
3. Which documentation changes (if any) need to be made because of this PR?
4. Checklist
No new tests required. There are a couple failing but look unrelated:
I have squashed any insignificant commits
I will squash commits once reviewed. Due to the large patch I wanted to keep the code changes separate from the vendor update.
This change has comments for package types, values, functions, and non-obvious lines of code
I am willing to help maintain this change if there are issues with it later
Steps (using Go 1.11):
go get
to get the specific versions for xenolf/lego and russross/blackfridaygo mod vendor
to vendor the deps usinggo mod
I've tested on two separate machines and
go run build.go
works on both with a fresh clone to a nonGOPATH
dir (if you are inGOPATH
you must setexport GO111MODULE=on
). That being said, if you don't want this huge change feel free to close :) I won't be offended ❤️