Skip to content

Add Go modules to vendor directory#17

Open
chris-crone wants to merge 3 commits intocompose-spec:masterfrom
chris-crone:vendor-modules
Open

Add Go modules to vendor directory#17
chris-crone wants to merge 3 commits intocompose-spec:masterfrom
chris-crone:vendor-modules

Conversation

@chris-crone
Copy link
Copy Markdown
Contributor

@chris-crone chris-crone commented Mar 17, 2020

Chatting to @thaJeztah and @justincormack, for things that we expect to ship as a binary it makes more sense to include the modules as vendored code.

This also speeds up the build for the CI as we don't need to fetch anything.

Comment thread ci/Dockerfile Outdated
Comment thread client/Dockerfile Outdated
Comment thread Makefile Outdated
@ndeloof
Copy link
Copy Markdown
Contributor

ndeloof commented Mar 17, 2020

This also speeds up the build for the CI as we don't need to fetch anything.

But you have to checkout vendor/, which will later include all previous versions of your dependencies with your git history, while go runtime on CI nodes could benefit go mod cache for same purpose.

Copy link
Copy Markdown
Contributor

@ndeloof ndeloof left a comment

Choose a reason for hiding this comment

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

-0

@chris-crone
Copy link
Copy Markdown
Contributor Author

It actually appears that you do need the GOFLAGS=-mod=vendor as otherwise the modules are pulled.

Signed-off-by: Christopher Crone <christopher.crone@docker.com>
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

SGTM

@tonistiigi ptal (you dealt with go mod a bit more than I did)

Comment thread scripts/validate/vendor

set -eu -o pipefail

go mod tidy 2>/dev/null && go mod vendor 2>/dev/null
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One thing to consider (no blocker) is if we want this to always be run, or only if either the Go version is updated, or if go.mod or vendor/ has been modified in a pull request

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Tonis didn't have access to this GitHub org. I've added him and will re-ping when he's accepted.

Copy link
Copy Markdown
Collaborator

@ulyssessouza ulyssessouza left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants