Closed parhamdoustdar closed 5 years ago
Since creating this issue, I've been looking around more in the source file, and wherever I'm looking, even at the function signatures, everything other than Go types (like string and integer) are shown as invalid type.
I'm also seeing the same in the output of the -debug
option – the types of everything are invalid
.
Can you run go list -e -json
on your package and paste the output in here?
Having the same issue. Modified the output to remove PII. Project is in ~/Projects/go/OrgName/repo-name go env
GOARCH="amd64"
GOBIN="/Users/user/go/bin"
GOCACHE="/Users/user/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/user/Projects/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/user/Projects/go/OrgName/repo-name/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/7k/xnyz2qcd1yn3hyy74y4lwrn8ybpqvw/T/go-build117854314=/tmp/go-build -gno-record-gcc-switches -fno-common"
go list -e -json git.company.com/OrgName/repo-name
{
"Dir": "/Users/user/Projects/go/OrgName/repo-name",
"ImportPath": "git.company.com/OrgName/repo-name",
"Name": "app",
"Module": {
"Path": "git.company.com/OrgName/repo-name",
"Main": true,
"Dir": "/Users/user/Projects/go/OrgName/repo-name",
"GoMod": "/Users/user/Projects/go/OrgName/repo-name/go.mod"
},
"Match": [
"git.company.com/OrgName/repo-name"
],
"Stale": true,
"StaleReason": "not installed but available in build cache",
"GoFiles": [
"app.go"
]
}
gocode -s -debug
2019/01/10 12:40:57 Got autocompletion request for '/Users/user/Projects/go/OrgName/repo-name/app.go'
2019/01/10 12:40:57 Cursor at: 2302
2019/01/10 12:40:57 -------------------------------------------------------
package app
// Credentials is the data model for authentication.
type Credentials# struct {
Username string
Password string
}
2019/01/10 12:40:57 -------------------------------------------------------
2019/01/10 12:40:57 Elapsed duration: 105.937865ms
2019/01/10 12:40:57 Offset: 0
2019/01/10 12:40:57 Number of candidates found: 1
2019/01/10 12:40:57 Candidates are:
2019/01/10 12:40:57 type Credentials invalid type
2019/01/10 12:40:57 =======================================================
Please let me know if there is any other info I can provide.
@Kryan90: can you try completing inside of a function? There's no way to provide completions for the name of a struct inside its declaration.
Oops. Didn't even think about that.
Completion wasn't working anywhere in my project, but it seems to be working now. I think I may have been missed running "go install -i" before.
Now spacemacs is hanging momentarily while waiting for completions, but that might be a completely different issue.
Ok, glad to hear it. This version of gocode is noticeably slower than mdempsky/gocode, so that could be what you're seeing.
I'm using Go 1.11.1,on Darwin amd64 , with the gocode that I just checked out today. Here is the bit of the code that I want completion on:
Here,
managementCluster
is shown as a valid completion candidate. However, I see this in the debug log:Since this is shown as invalid type, when I want to get completion on that variable's fields, it fails.
Any ideas on why this would be happening?