Note:
I am getting the same error `could not import C (cgo preprocessing failed) (typecheck) no matter which version of golangci-lint I use while I am running golangci-lint.
I have seen this issue on Github: https://github.com/golangci/golangci-lint/issues/1176 where it is told to add header files (like net-snmp/net-snmp-config.h
and net-snmp/mib_api.h
) to /usr/local/include.
Personally, I found this kinda files in /usr/include
directory, and I copied all files with .h
extension to /usr/local/include.
Plus, I also installed libsnmp-dev
as it is said in the link above.
But, I got the same error again...
Any ideas to solve this issue?
I don't know why but the solution was damn easy for this issue which took my 2 days.
What I did was to change import "C"
to import ( "C" )
in /usr/local/go/src/runtime/cgo/cgo.go
file, and installing gcc.
That's it, guys:)
PS: you are welcome to share your own answers as well because personally I didn't understand my own solution
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.