Golangci-lint: BUG: failed run

Created on 8 Jul 2019  路  5Comments  路  Source: golangci/golangci-lint

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

bug

Most helpful comment

Please, install gcc

All 5 comments

[Error] [golangci-lint] /usr/local/go/src/net/cgo_bsd.go:13:8: could not import C (no metadata for C) (typecheck)

I did not know what these error come from.

Work with golangci-lint via vim-ale

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.

Please, install gcc

@stszap Install libc-dev

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kipply picture kipply  路  4Comments

KeepMasterBranch picture KeepMasterBranch  路  3Comments

liubog2008 picture liubog2008  路  3Comments

moolibdensplk picture moolibdensplk  路  4Comments

nektro picture nektro  路  3Comments