Navigation Menu

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

cmd.go: why we use go mod download before build go application? #40242

Closed
4orty opened this issue Jul 16, 2020 · 2 comments
Closed

cmd.go: why we use go mod download before build go application? #40242

4orty opened this issue Jul 16, 2020 · 2 comments

Comments

@4orty
Copy link

4orty commented Jul 16, 2020

What version of Go are you using (go version)?

$ go version
1.14

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

When people make dockerfile of go application with module, most of them make like this.

FROM golang
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN go build

But when i tested like below, it also works well.

FROM golang
COPY . .
RUN go build

what's the difference?
If i use go mod download command, can i get some advantages?

What did you expect to see?

What did you see instead?

@davecheney
Copy link
Contributor

Thank you for raising this issue. Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For asking questions, see:

@agnivade
Copy link
Contributor

Presumably, it's about creating extra docker layers so that small changes don't make a big difference in the re-build time.

@golang golang locked and limited conversation to collaborators Jul 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants