diff --git a/content/guides/golang.md b/content/guides/golang.md index 07476b0f5a0..2a39f00f33b 100644 --- a/content/guides/golang.md +++ b/content/guides/golang.md @@ -242,6 +242,12 @@ This `COPY` command uses a wildcard to copy all files with `.go` extension located in the current directory on the host (the directory where the `Dockerfile` is located) into the current directory inside the image. +`COPY *.go ./` only matches `.go` files in that one directory. Packages +under `pkg/` or other subdirectories are left out, so `go build` then +fails to find them. For a multi-package module, copy the module root +instead (`COPY . .`) and use a `.dockerignore` file to keep the context +small. + Now, to compile your application, use the familiar `RUN` command: ```dockerfile