-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Hi, I have encountered this error: "go list failed to return CompiledGoFiles. This may indicate failure to perform cgo processing; try building at the command line. See https://golang.org/issue/38990." after I installed the package locally.
- This is the relevant
go env
set GO111MODULE=on
set GOENV=C:\Users\USERNAME\AppData\Roaming\go\env
set GOPATH=C:\Users\USERNAME\go
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOVERSION=go1.19.2
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\USERNAME\go\pkg\mod\github.com\microsoft\go-crypto-openssl@v0.2.6\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-
- When I run
go list -json -compiled -e
{
"Dir": "C:\\Users\\USERNAME\\go\\pkg\\mod\\github.com\\microsoft\\go-crypto-openssl@v0.2.6\\openssl",
"ImportPath": "github.com/microsoft/go-crypto-openssl/openssl",
"Name": "openssl",
"Root": "C:\\Users\\USERNAME\\go\\pkg\\mod\\github.com\\microsoft\\go-crypto-openssl@v0.2.6",
"Module": {
"Path": "github.com/microsoft/go-crypto-openssl",
"Main": true,
"Dir": "C:\\Users\\USERNAME\\go\\pkg\\mod\\github.com\\microsoft\\go-crypto-openssl@v0.2.6",
"GoMod": "C:\\Users\\USERNAME\\go\\pkg\\mod\\github.com\\microsoft\\go-crypto-openssl@v0.2.6\\go.mod",
"GoVersion": "1.16"
},
"Match": [
"."
],
"Stale": true,
"StaleReason": "not installed but available in build cache",
"GoFiles": [
"big.go"
],
"CompiledGoFiles": [
"big.go"
],
"IgnoredGoFiles": [
"aes.go",
"aes_test.go",
"ecdh.go",
"ecdh_test.go",
"ecdsa.go",
"ecdsa_test.go",
"evpkey.go",
"openssl_funcs.h"
]
}
- My gopls settings
{
// "go.buildFlags": ["-tags=linux,!android"],
"gopls": {
"build.experimentalWorkspaceModule": true,
"build.allowModfileModifications": true
}
}
It seems to ignore those files with C imported, so basically the only file that is successfully compiled is big.go, and this made my code that uses this package not able to recognize functions/identifiers in those cgo files. For example, it can only understand openssl.BigInt because this is the only thing that is compiled. All other requests, such as openssl.NewAESCipher, will have error similar to this shown: "undefined: openssl.NewAESCipher" with yellow squiggly lines "NewAESCipher not declared by package openssl (compile)"
Is there something wrong with my gopls settings, or is it an issue with go version (go.mod indicates 1.16 yet go version is 1.19)? Thanks!