profile
viewpoint

Ask questionsBUG: failed run

Thank you for creating the issue!

ERRO Running error: context loading failed: failed to load program with go/packages: go [list -e -json -compiled=true -test=true -export=false -deps=true -find=false -- ./...]: exit status 2: # runtime/cgo _cgo_export.c:3:10: fatal error: 'stdlib.h' file not found

golangci/golangci-lint

Answer questions stszap

I got similar errors (many similar lines) while trying to run golangci-lint in a docker container. Base image golang:1.10-alpine golangci-ling 1.15.0.

...
/usr/local/go/src/os/user/cgo_lookup_unix.go:46:8: could not import C (no metadata for C) (typecheck)
package accounting
...

Fixed it by switchin to golang:1.12-alpine base image and golangci-ling 1.17.1.

Then I got new errors

exec: "gcc": executable file not found in $PATH

and

ERRO Running error: context loading failed: failed to load program with go/packages: go [list -e -json -compiled=true -test=false -export=false -deps=true -find=false -- ./pkg/...]: exit status 2: # runtime/cgo
_cgo_export.c:3:10: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
          ^~~~~~~~~~

after trying to install different packages. Fixed them by installing build-base inside the image (apk add build-base).

I just started to use this tool so I'm not sure what exactly the problem was (dependency on a compiler and a few libs?) and my solution may not be the optimal one but I hope it helps.

useful!

Related questions

confusing error message "File is not goimports-ed (goimports)" hot 3
confusing error message &#34;File is not goimports-ed (goimports)&#34; - golangci-lint hot 2
please surpport ignore someOne fuction's igored error hot 1
Setting GO111MODULE=on for golangci.com hot 1
golangci-lint "DecodeRune not declared by package utf8" with golang 1.13 hot 1
Cannot `go get` due to invalid pseudo-version hot 1
go get cmd/golangci-lint fails on Go 1.13 (tip) which uses proxy.golang.org (HTTP error 410 Gone) hot 1
Install golangci-lint locally using Windows hot 1
go get cmd/golangci-lint fails on Go 1.13 (tip) which uses proxy.golang.org (HTTP error 410 Gone) hot 1
Golangci-lint Incompatibility with newer versions of Go? hot 1
panic on bodyclose hot 1
concurrent map access on 1.17.1 hot 1
[Feature] TODO/FIXME linter hot 1
Failed to build golangci-lint v1.17.1 when enable GO111MODULE hot 1
Build errors using Go 1.13 hot 1
source:https://uonfu.com/
Github User Rank List