Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

chore: replace govendor with go mod and update docs #647

Merged
merged 1 commit into from
Jul 11, 2019

Conversation

yeya24
Copy link
Collaborator

@yeya24 yeya24 commented Jul 2, 2019

Ⅰ. Describe what this PR did

Replace govendor with go mod since we have already updated to go 1.12.6.

Ⅱ. Does this pull request fix one issue?

fix second part of #634

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@pouchrobot
Copy link
Collaborator

Thanks for your contribution. 🍻 @yeya24
While we thought PR TITLE could be more specific, longer than 20 chars.
Please edit this PR title instead of opening a new one.
More details, please refer to https://github.com/dragonflyoss/Dragonfly/blob/master/CONTRIBUTING.md

@yeya24 yeya24 changed the title chore: add go mod chore: replace govendor with go mod and update docs Jul 2, 2019
@allencloud
Copy link
Contributor

It is a big change to the project.
I am wondering if there is any possibility to check the go mod file's correctness via Makefile target?
If we can do that, we could validate the dependency's correctness.
Just my little opinion. Wish your feedback. @yeya24

@yeya24 yeya24 changed the title chore: replace govendor with go mod and update docs [WIP] chore: replace govendor with go mod and update docs Jul 2, 2019
@yeya24
Copy link
Collaborator Author

yeya24 commented Jul 2, 2019

It is a big change to the project.
I am wondering if there is any possibility to check the go mod file's correctness via Makefile target?
If we can do that, we could validate the dependency's correctness.
Just my little opinion. Wish your feedback. @yeya24

@allencloud
Yes this validation is important. And I see this Makefile in Prometheus is like doing what we want. Is this correct?
I change title to WIP and I will try to work on this.

@inoc603
Copy link
Member

inoc603 commented Jul 3, 2019

Since we're hopping on the go mod train, maybe we can consider not checking the vendor/ directory into git repo. go.sum and go.mod can pin dependency versions. Removing vendor/ will prevent huge PRs when changing dependencies. Also we don't have to validate whether vendor/ and go.sum matches.

Of course not checking in vendor/ means we would spend more time downloading dependencies during CI. This can be solved by either:

  • Make an image with dependencies, which is automatically updated when go.sum and go.mod changes, and do compiling in it.
  • Or use a proxy that supports the module proxy protocol, some options can be found here

@yeya24
Copy link
Collaborator Author

yeya24 commented Jul 3, 2019

@allencloud @lowzj WDYT?

@starnop
Copy link
Contributor

starnop commented Jul 9, 2019

@lowzj @allencloud @inoc603 Now that we have updated the go version to 1.12.6, so let's make this PR as a break change for release 0.4.1. WDYT?

@starnop
Copy link
Contributor

starnop commented Jul 9, 2019

Since we're hopping on the go mod train, maybe we can consider not checking the vendor/ directory into git repo. go.sum and go.mod can pin dependency versions. Removing vendor/ will prevent huge PRs when changing dependencies. Also we don't have to validate whether vendor/ and go.sum matches.

Of course not checking in vendor/ means we would spend more time downloading dependencies during CI. This can be solved by either:

  • Make an image with dependencies, which is automatically updated when go.sum and go.mod changes, and do compiling in it.
  • Or use a proxy that supports the module proxy protocol, some options can be found here

I agree with that. Even though go mod now supports the vendor, however, it will be abandoned in the future. And as @inoc603 said, we can use docker image to provide repeatable environments.

@yeya24
Copy link
Collaborator Author

yeya24 commented Jul 9, 2019

Currently I met some problems in fixing ci.

Makefile Outdated
@@ -94,13 +100,33 @@ unit-test: build-dirs
./hack/unit-test.sh
.PHONY: unit-test

integration-test:
@go build ./test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ @go build ./test/ @go test ./test ? Maybe it's the cause of the failure of the integration test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this help!

Makefile Outdated
go-mod-vendor:
@echo "Begin to vendor go mod dependency"
@go mod vendor
.PHONY: go-mod-tidy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go-mod-vendor?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

hack/env.sh Outdated
@@ -24,3 +24,6 @@ GOOS=$(go env GOOS)
GOARCH=$(go env GOARCH)
export GOOS
export GOARCH

export GO111MODULE=on
export GOPROXY=https://goproxy.io
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a newline at end of file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@codecov-io
Copy link

codecov-io commented Jul 10, 2019

Codecov Report

Merging #647 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #647      +/-   ##
==========================================
+ Coverage   48.23%   48.25%   +0.01%     
==========================================
  Files          99       99              
  Lines        5896     5896              
==========================================
+ Hits         2844     2845       +1     
  Misses       2827     2827              
+ Partials      225      224       -1
Impacted Files Coverage Δ
supernode/daemon/mgr/scheduler/manager.go 24.81% <0%> (+0.75%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d33074e...8ae6c74. Read the comment docs.

Signed-off-by: yeya24 <[email protected]>
@yeya24
Copy link
Collaborator Author

yeya24 commented Jul 10, 2019

@starnop @lowzj Can you review this again? Pass the ci now.

@starnop
Copy link
Contributor

starnop commented Jul 10, 2019

LGTM. And @lowzj PTAL again.

@starnop starnop changed the title [WIP] chore: replace govendor with go mod and update docs chore: replace govendor with go mod and update docs Jul 10, 2019
@starnop starnop merged commit 13283a1 into dragonflyoss:master Jul 11, 2019
@yeya24 yeya24 deleted the feature/add-go-mod branch July 11, 2019 09:08
@allencloud
Copy link
Contributor

Great work. We are moving to go mod. 👍 @yeya24 @starnop

starnop added a commit to starnop/Dragonfly that referenced this pull request Nov 27, 2019
chore: replace govendor with go mod and update docs
inoc603 pushed a commit to inoc603/Dragonfly that referenced this pull request Dec 23, 2019
chore: replace govendor with go mod and update docs
sungjunyoung pushed a commit to sungjunyoung/Dragonfly that referenced this pull request May 8, 2022
* chore: update version

Signed-off-by: Gaius <[email protected]>

* chore: update git version

Signed-off-by: Gaius <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants