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
Answer questions stszap
I got similar errors (many similar lines) while trying to run golangci-lint in a docker container. Base image
... /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
Then I got new errors
exec: "gcc": executable file not found in $PATH
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.