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

build: golang: does not copy all *.go files. #14609

Open
jtagcat opened this issue Apr 26, 2022 · 8 comments
Open

build: golang: does not copy all *.go files. #14609

jtagcat opened this issue Apr 26, 2022 · 8 comments
Labels
area/engine Issue affects Docker engine/daemon lifecycle/frozen

Comments

@jtagcat
Copy link

jtagcat commented Apr 26, 2022

File: language/golang/build-images.md

COPY *.go ./ is misleading. It does not copy all needed files.

Using subdirectories and -packages is not uncommon in golang:

. (spotify-togit)
├── main.go
├── pkg
│   ├── git.go
│   └── os.go

Building the image in the container fails for non-obvious reasons:

main.go:15:2: no required module provides package github.com/jtagcat/spotify-togit/pkg; to add it:
        go get github.com/jtagcat/spotify-togit/pkg

pkg/ of the same module didn't get copied over.

Depends on this almost 3y old issue: moby/moby#39530

GitHub Etiquette

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on new comments, or get notified of resolution with 'Status'.
@jtagcat
Copy link
Author

jtagcat commented Apr 26, 2022

@dockertopia dockertopia added the area/engine Issue affects Docker engine/daemon label May 31, 2022
@docker-robott
Copy link
Collaborator

There hasn't been any activity on this issue for a long time.
If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment.
If not, this issue will be closed in 14 days. This helps our maintainers focus on the active issues.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

@jtagcat
Copy link
Author

jtagcat commented Jan 3, 2023

unstale

no sane way of copying all go files reliably without copying a file at a time, or whole root

@jtagcat
Copy link
Author

jtagcat commented Jan 3, 2023

/remove-lifecycle stale

@jtagcat
Copy link
Author

jtagcat commented Jan 3, 2023

/lifecycle frozen

@krlozadan
Copy link

Still having the same issue. It's kind of annoying but you still have to do COPY . . and rely on a .dockerignore file to avoid files you don't want to

@sedyh
Copy link

sedyh commented May 27, 2024

+1 for this, it will not work with standard layout where all entrypoints are located in cmd subpackages.
The doc should be updated.

Error: error building at STEP "COPY *.go ./": checking on sources under "<path>/go/app": Rel: can't make  relative to <path>/go/app; copier: stat: ["/*.go"]: no such file or directory

My structure:

.
├── cmd
│   └── app
│       └── main.go
├── go.mod
└── go.sum

@kalalannn
Copy link

still issue
Step 5/9 : COPY *.go ./
COPY failed: no source files were specified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/engine Issue affects Docker engine/daemon lifecycle/frozen
Projects
None yet
Development

No branches or pull requests

6 participants