-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
docker run failed #897
Comments
@DarthPestilane Does this only happen on macOS with Docker? Do you get the same error with the binary release? |
Seems like same as #884 |
# tags=(latest latest-alpine v1.21-alpine v1.22-alpine v1.22.2-alpine)
# for tag in "${tags[@]}"; do echo "==== $tag"; docker run --rm -ti -v $(pwd):$(pwd) -w $(pwd) golangci/golangci-lint:$tag golangci-lint run; done
==== latest
ERRO Running error: context loading failed: failed to load program with go/packages: could not determine GOARCH and Go compiler
==== latest-alpine
ERRO Running error: context loading failed: failed to load program with go/packages: could not determine GOARCH and Go compiler
==== v1.21-alpine
ERRO Running error: context loading failed: failed to load program with go/packages: could not determine GOARCH and Go compiler
==== v1.22-alpine
ERRO Running error: context loading failed: failed to load program with go/packages: could not determine GOARCH and Go compiler
==== v1.22.2-alpine
ERRO Running error: context loading failed: failed to load program with go/packages: could not determine GOARCH and Go compiler # docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.22.2 golangci-lint run -v
level=info msg="[config_reader] Config search paths: [./ /app /]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[lintersdb] Active 30 linters: [bodyclose deadcode depguard dogsled funlen gocognit goconst gocritic gocyclo godox gofmt goimports golint gomnd gosec gosimple govet ineffassign misspell nakedret prealloc scopelint staticcheck structcheck stylecheck typecheck unconvert unused varcheck wsl]"
level=info msg="[lintersdb] Active 30 linters: [bodyclose deadcode depguard dogsled funlen gocognit goconst gocritic gocyclo godox gofmt goimports golint gomnd gosec gosimple govet ineffassign misspell nakedret prealloc scopelint staticcheck structcheck stylecheck typecheck unconvert unused varcheck wsl]"
level=info msg="[loader] Go packages loading at mode 575 (imports|name|types_sizes|compiled_files|deps|exports_file|files) took 2.365517004s"
level=error msg="Running error: context loading failed: failed to load program with go/packages: could not determine GOARCH and Go compiler"
level=info msg="Memory: 25 samples, avg is 68.9MB, max is 68.9MB"
level=info msg="Execution took 2.375639296s"
# docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.22.2 golangci-lint run -v
level=info msg="[config_reader] Config search paths: [./ /app /]"
level=info msg="[lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck]"
level=info msg="[lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck]"
level=info msg="[loader] Go packages loading at mode 575 (name|types_sizes|exports_file|deps|files|imports|compiled_files) took 2.42721109s"
level=error msg="Running error: context loading failed: failed to load program with go/packages: could not determine GOARCH and Go compiler"
level=info msg="Memory: 26 samples, avg is 68.7MB, max is 68.7MB"
level=info msg="Execution took 2.43755305s" Not experiencing the same issue when running |
Follow-up on my last comment: When executing the same commands with |
We found in reviewdog/action-golangci-lint#21 this error occurs with projects importing private module dependencies. I've tested further by downloading modules to host, mounting the host's
This successfully ran, bypassing the error. It's not ideal though, as I'm not yet sure how (if possible) to mount a volume from host w/in GitHub Actions to solve my own needs. |
@DarthPestilane @Luzifer @ClaudiaJ : What are the outputs when you add the environment variables |
# docker run --rm -v $(pwd):/app -w /app -e GL_DEBUG=linters_output -e GOPACKAGESPRINTGOLISTERRORS=1 golangci/golangci-lint:v1.22.2-alpine golangci-lint run -v
level=info msg="[config_reader] Config search paths: [./ /app /]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[lintersdb] Active 27 linters: [bodyclose deadcode depguard dogsled funlen gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign misspell nakedret scopelint staticcheck structcheck stylecheck typecheck unconvert unused varcheck]"
level=info msg="[lintersdb] Active 27 linters: [bodyclose deadcode depguard dogsled funlen gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign misspell nakedret scopelint staticcheck structcheck stylecheck typecheck unconvert unused varcheck]"
GOROOT=/usr/local/go GOPATH=/go GO111MODULE= PWD=/app go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=true" "-deps=true" "-find=false" "--" "./..." stderr: <<go: github.com/[[REDACTED]]@v0.0.0-20191029153130-d813d6d9dc53: git init --bare in /go/pkg/mod/cache/vcs/3ca44adb07787bed76ecd6b968fcab6d748d3e60a027ceab941754ea58cef49f: exec: "git": executable file not found in $PATH
>>
GOROOT=/usr/local/go GOPATH=/go GO111MODULE= PWD= go [list -f {{context.GOARCH}} {{context.Compiler}} -- unsafe] stderr: <<go: github.com/[[REDACTED]]@v0.0.0-20191029153130-d813d6d9dc53: git init --bare in /go/pkg/mod/cache/vcs/3ca44adb07787bed76ecd6b968fcab6d748d3e60a027ceab941754ea58cef49f: exec: "git": executable file not found in $PATH
>>
level=info msg="[loader] Go packages loading at mode 575 (compiled_files|deps|exports_file|files|imports|name|types_sizes) took 2.364244004s"
level=error msg="Running error: context loading failed: failed to load program with go/packages: could not determine GOARCH and Go compiler"
level=info msg="Memory: 25 samples, avg is 68.9MB, max is 69.2MB"
level=info msg="Execution took 2.368312899s" # docker run --rm -v $(pwd):/app -w /app -e GL_DEBUG=linters_output -e GOPACKAGESPRINTGOLISTERRORS=1 golangci/golangci-lint:v1.22.2 golangci-lint run -v
level=info msg="[config_reader] Config search paths: [./ /app /]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[lintersdb] Active 27 linters: [bodyclose deadcode depguard dogsled funlen gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign misspell nakedret scopelint staticcheck structcheck stylecheck typecheck unconvert unused varcheck]"
level=info msg="[lintersdb] Active 27 linters: [bodyclose deadcode depguard dogsled funlen gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign misspell nakedret scopelint staticcheck structcheck stylecheck typecheck unconvert unused varcheck]"
GOROOT=/usr/local/go GOPATH=/go GO111MODULE= PWD=/app go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=true" "-deps=true" "-find=false" "--" "./..." stderr: <<go: github.com/[[REDACTED]]@v0.0.0-20191029153130-d813d6d9dc53: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/3ca44adb07787bed76ecd6b968fcab6d748d3e60a027ceab941754ea58cef49f: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
>>
GOROOT=/usr/local/go GOPATH=/go GO111MODULE= PWD= go [list -f {{context.GOARCH}} {{context.Compiler}} -- unsafe] stderr: <<go: github.com/[[REDACTED]]@v0.0.0-20191029153130-d813d6d9dc53: invalid version: git fetch -f https://github.com/[[REDACTED]]
fatal: could not read Username for 'https://github.com': terminal prompts disabled
>>
level=info msg="[loader] Go packages loading at mode 575 (exports_file|types_sizes|compiled_files|deps|files|imports|name) took 2.370997212s"
level=error msg="Running error: context loading failed: failed to load program with go/packages: could not determine GOARCH and Go compiler"
level=info msg="Memory: 25 samples, avg is 69.2MB, max is 69.4MB"
level=info msg="Execution took 2.379085073s" I assumed something like this when |
Adding
That issue will occur since |
Good call! With the provided Docker image:
Noting git is not installed here per the error, but is installed w/ the Dockerfile provided by https://github.com/reviewdog/action-golangci-lint, I tested adding git: ROM golangci/golangci-lint:v1.22-alpine
RUN apk --no-cache add git
Passing in a personal access token and running in the container |
Seems like there are nothing we can do more. |
run this
as readme.md said.
and error happend:
tested on macOS
The text was updated successfully, but these errors were encountered: