Skip to content
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

Add Go modules to vendor directory #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

chris-crone
Copy link
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.

client/Dockerfile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@ndeloof
Copy link
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
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
Contributor Author

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

Signed-off-by: Christopher Crone <[email protected]>
Signed-off-by: Christopher Crone <[email protected]>
Signed-off-by: Christopher Crone <[email protected]>
Copy link
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)


set -eu -o pipefail

go mod tidy 2>/dev/null && go mod vendor 2>/dev/null
Copy link
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
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
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