Closed hi-iwi closed 4 years ago
@luexu: What is the output of gopls version
? Are you using Go modules or GOPATH? If you are using modules, make sure that you open VS Code at the root of your module (at the directory that contains the go.mod
file).
@luexu: What is the output of
gopls version
? Are you using Go modules or GOPATH? If you are using modules, make sure that you open VS Code at the root of your module (at the directory that contains thego.mod
file).
PS F:\Aa\proj\go\bin> .\gopls.exe version golang.org/x/tools/gopls 0.2.2 golang.org/x/tools/gopls@v0.2.2 h1:ujGisyytgY1VGcmd66wIJ9+wVAfmodXj6daHM43HRXk=
I'm not using Go modules
What directory do you open in VS Code - is it your entire GOPATH? Can you share the output of gopls -rpc.trace -v check path/to/file.go
for some file in your project?
What directory do you open in VS Code - is it your entire GOPATH? Can you share the output of
gopls -rpc.trace -v check path/to/file.go
for some file in your project?
not the entire Gopath. I opened F:\Aa . GOPATH F:\Aa\proj\go is just a sub-directory.
PS F:\Aa\proj\go\bin> ./gopls '-rpc.trace' -v check F:\Aa\proj\go\src\project\luexu\main.go
2019/12/13 12:09:26 Info:2019/12/13 12:09:26 Build info
----------
golang.org/x/tools/gopls 0.2.2
golang.org/x/tools/gopls@v0.2.2 h1:ujGisyytgY1VGcmd66wIJ9+wVAfmodXj6daHM43HRXk=
github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/tools@v0.0.0-20191206201009-952e2c076240 h1:metzFnqcC0vUPmZX4El8bICiQU9hieZ3L9dXAitxVXQ=
golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
honnef.co/go/tools@v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
Go info
-------
go version go1.13.4 windows/amd64
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Aa\AppData\Local\go-build
set GOENV=C:\Users\Aa\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=F:\Aa\proj\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=E:\Golang
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=E:\Golang\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\Aa\AppData\Local\Temp\go-build215476670=/tmp/go-build -gno-record-gcc-switches
2019/12/13 12:09:27 Info:2019/12/13 12:09:27 35.3048ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\bin go "env" "GOMOD", stderr: <<>> stdout: <<
>>
2019/12/13 12:09:27 Info:2019/12/13 12:09:27 37.2589ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\bin go "list" "-m" "-json" "all", stderr: <<go list -m: not using modules
>> stdout: <<>>
2019/12/13 12:09:27 Info:2019/12/13 12:09:27 86.3924ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\bin go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "builtin", stderr: <<>> stdout: <<{
"Dir": "E:\\Golang\\src\\builtin",
"ImportPath": "builtin",
"Name": "builtin",
"Doc": "Package builtin provides documentation for Go's predeclared identifiers.",
"Target": "E:\\Golang\\pkg\\windows_amd64\\builtin.a",
"Root": "E:\\Golang",
"Match": [
"builtin"
],
"Goroot": true,
"Standard": true,
"GoFiles": [
"builtin.go"
]
}
>>
2019/12/13 12:09:27 Info:2019/12/13 12:09:27 56.9426ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\bin go "env" "GOPATH", stderr: <<>> stdout: <<F:\Aa\proj\go
>>
2019/12/13 12:09:27 Info:2019/12/13 12:09:27 22.4485ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\bin go "list" "-m" "-json" "all", stderr: <<go list -m: not using modules
>> stdout: <<>>
2019/12/13 12:09:27 Info:2019/12/13 12:09:27 22.4485ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\bin go "env" "GOMOD", stderr: <<>> stdout: <<
>>
2019/12/13 12:09:27 Info:2019/12/13 12:09:27 21.6435ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\bin go "env" "GOPATH", stderr: <<>> stdout: <<F:\Aa\proj\go
Looks like gopls
is not able to find the metadata for your package. Can you try running the same command, but this time, can you cd
into your F:\Aa\proj\go\src\project\luexu
directory?
Looks like
gopls
is not able to find the metadata for your package. Can you try running the same command, but this time, can youcd
into yourF:\Aa\proj\go\src\project\luexu
directory?
PS F:\Aa\proj\go\src\project\luexu> F:\Aa\proj\go\bin\gopls '-rpc.trace' -v check F:\Aa\proj\go\src\project\luexu\main.go
2019/12/15 02:11:20 Info:2019/12/15 02:11:20 Build info
----------
golang.org/x/tools/gopls 0.2.2
golang.org/x/tools/gopls@v0.2.2 h1:ujGisyytgY1VGcmd66wIJ9+wVAfmodXj6daHM43HRXk=
github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/tools@v0.0.0-20191206201009-952e2c076240 h1:metzFnqcC0vUPmZX4El8bICiQU9hieZ3L9dXAitxVXQ=
golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
honnef.co/go/tools@v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
Go info
-------
go version go1.13.4 windows/amd64
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Aa\AppData\Local\go-build
set GOENV=C:\Users\Aa\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=F:\Aa\proj\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=E:\Golang
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=E:\Golang\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\Aa\AppData\Local\Temp\go-build966085754=/tmp/go-build -gno-record-gcc-switches
2019/12/15 02:11:20 Info:2019/12/15 02:11:20 24.4002ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\src\project\luexu go "list" "-m" "-json" "all", stderr: <<go list -m: not using modules
>> stdout: <<>>
2019/12/15 02:11:20 Info:2019/12/15 02:11:20 28.3041ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\src\project\luexu go "env" "GOMOD", stderr: <<>> stdout: <<
>>
2019/12/15 02:11:20 Info:2019/12/15 02:11:20 21.5785ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\src\project\luexu go "env" "GOPATH", stderr: <<>> stdout: <<F:\Aa\proj\go
>>
2019/12/15 02:11:20 Info:2019/12/15 02:11:20 79.091ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\src\project\luexu go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "builtin", stderr: <<>> stdout: <<{
"Dir": "E:\\Golang\\src\\builtin",
"ImportPath": "builtin",
"Name": "builtin",
"Doc": "Package builtin provides documentation for Go's predeclared identifiers.",
"Target": "E:\\Golang\\pkg\\windows_amd64\\builtin.a",
"Root": "E:\\Golang",
"Match": [
"builtin"
],
"Goroot": true,
"Standard": true,
"GoFiles": [
"builtin.go"
]
}
>>
2019/12/15 02:11:20 Info:2019/12/15 02:11:20 22.4479ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\src\project\luexu go "env" "GOMOD", stderr: <<>> stdout: <<
>>
2019/12/15 02:11:20 Info:2019/12/15 02:11:20 26.4584ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\src\project\luexu go "list" "-m" "-json" "all", stderr: <<go list -m: not using modules
>> stdout: <<>>
2019/12/15 02:11:20 Info:2019/12/15 02:11:20 21.5505ms for GOROOT= GOPATH=F:\Aa\proj\go GO111MODULE= PWD=F:\Aa\proj\go\src\project\luexu go "env" "GOPATH", stderr: <<>> stdout: <<F:\Aa\proj\go
>>
Hm, it looks like the package metadata query isn't even running in the above log. What is the output of go list -e -json -compiled -test F:\Aa\proj\go\src\project\luexu
?
Hm, it looks like the package metadata query isn't even running in the above log. What is the output of
go list -e -json -compiled -test F:\Aa\proj\go\src\project\luexu
?
PS C:\Windows\system32> go list -e -json -compiled -test F:\Aa\proj\go\src\project\luexu
{
"Dir": "F:\\Aa\\proj\\go\\src\\project\\luexu",
"ImportPath": "project/luexu",
"Name": "main",
"Target": "F:\\Aa\\proj\\go\\bin\\luexu.exe",
"Root": "F:\\Aa\\proj\\go",
"Match": [
"F:/Aa/proj/go/src/project/luexu"
],
"Stale": true,
"StaleReason": "stale dependency: github.com/google/uuid",
"GoFiles": [
"main.go"
],
"CompiledGoFiles": [
"main.go"
],
"Imports": [
"flag",
"fmt",
"github.com/luexu/AaGo/aa",
"project/luexu/app/router",
"project/luexu/app/service",
"project/luexu/bootstrap",
"project/luexu/console",
"runtime"
],
"Deps": [
"bufio",
"bytes",
"compress/flate",
"compress/gzip",
"compress/lzw",
"compress/zlib",
"container/list",
"context",
"crypto",
"crypto/aes",
"crypto/cipher",
"crypto/des",
"crypto/dsa",
"crypto/ecdsa",
"crypto/ed25519",
"crypto/ed25519/internal/edwards25519",
"crypto/elliptic",
"crypto/hmac",
"crypto/internal/randutil",
"crypto/internal/subtle",
"crypto/md5",
"crypto/rand",
"crypto/rc4",
"crypto/rsa",
"crypto/sha1",
"crypto/sha256",
"crypto/sha512",
"crypto/subtle",
"crypto/tls",
"crypto/x509",
"crypto/x509/pkix",
"database/sql",
"database/sql/driver",
"encoding",
"encoding/asn1",
"encoding/base64",
"encoding/binary",
"encoding/gob",
"encoding/hex",
"encoding/json",
"encoding/pem",
"encoding/xml",
"errors",
"flag",
"fmt",
"github.com/BurntSushi/toml",
"github.com/CloudyKit/jet",
"github.com/CloudyKit/jet/vendor/github.com/CloudyKit/fastprinter",
"github.com/Joker/jade",
"github.com/NetEase-Object-Storage/nos-golang-sdk/auth",
"github.com/NetEase-Object-Storage/nos-golang-sdk/config",
"github.com/NetEase-Object-Storage/nos-golang-sdk/httpclient",
"github.com/NetEase-Object-Storage/nos-golang-sdk/logger",
"github.com/NetEase-Object-Storage/nos-golang-sdk/model",
"github.com/NetEase-Object-Storage/nos-golang-sdk/nosclient",
"github.com/NetEase-Object-Storage/nos-golang-sdk/nosconst",
"github.com/NetEase-Object-Storage/nos-golang-sdk/noserror",
"github.com/NetEase-Object-Storage/nos-golang-sdk/utils",
"github.com/Shopify/goreferrer",
"github.com/aliyun/alibaba-cloud-sdk-go/sdk",
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth",
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials",
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider",
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers",
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints",
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors",
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests",
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses",
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils",
"github.com/aliyun/alibaba-cloud-sdk-go/services/dysmsapi",
"github.com/aliyun/alibaba-cloud-sdk-go/vendor/github.com/jmespath/go-jmespath",
"github.com/aliyun/alibaba-cloud-sdk-go/vendor/github.com/json-iterator/go",
"github.com/aliyun/alibaba-cloud-sdk-go/vendor/github.com/modern-go/concurrent",
"github.com/aliyun/alibaba-cloud-sdk-go/vendor/github.com/modern-go/reflect2",
"github.com/aliyun/alibaba-cloud-sdk-go/vendor/gopkg.in/ini.v1",
"github.com/aymerick/raymond",
"github.com/aymerick/raymond/ast",
"github.com/aymerick/raymond/lexer",
"github.com/aymerick/raymond/parser",
"github.com/chris-ramon/douceur/css",
"github.com/chris-ramon/douceur/parser",
"github.com/eknkc/amber",
"github.com/eknkc/amber/parser",
"github.com/fatih/structs",
"github.com/flosch/pongo2",
"github.com/go-sql-driver/mysql",
"github.com/gomodule/redigo/redis",
"github.com/google/uuid",
"github.com/gorilla/css/scanner",
"github.com/iris-contrib/blackfriday",
"github.com/iris-contrib/middleware/cors",
"github.com/iris-contrib/schema",
"github.com/json-iterator/go",
"github.com/juju/errors",
"github.com/kataras/golog",
"github.com/kataras/iris",
"github.com/kataras/iris/cache",
"github.com/kataras/iris/cache/cfg",
"github.com/kataras/iris/cache/client",
"github.com/kataras/iris/cache/client/rule",
"github.com/kataras/iris/cache/entry",
"github.com/kataras/iris/cache/ruleset",
"github.com/kataras/iris/cache/uri",
"github.com/kataras/iris/context",
"github.com/kataras/iris/core/errgroup",
"github.com/kataras/iris/core/handlerconv",
"github.com/kataras/iris/core/host",
"github.com/kataras/iris/core/memstore",
"github.com/kataras/iris/core/netutil",
"github.com/kataras/iris/core/router",
"github.com/kataras/iris/macro",
"github.com/kataras/iris/macro/handler",
"github.com/kataras/iris/macro/interpreter/ast",
"github.com/kataras/iris/macro/interpreter/lexer",
"github.com/kataras/iris/macro/interpreter/parser",
"github.com/kataras/iris/macro/interpreter/token",
"github.com/kataras/iris/middleware/logger",
"github.com/kataras/iris/middleware/recover",
"github.com/kataras/iris/view",
"github.com/kataras/pio",
"github.com/kataras/pio/terminal",
"github.com/klauspost/compress/flate",
"github.com/klauspost/compress/gzip",
"github.com/luexu/AaGo/aa",
"github.com/luexu/AaGo/adto",
"github.com/luexu/AaGo/ae",
"github.com/luexu/AaGo/com",
"github.com/luexu/AaGo/dict",
"github.com/luexu/AaGo/format",
"github.com/luexu/AaGo/util",
"github.com/luexu/AaGo/util/healthcheck",
"github.com/luexu/aenum",
"github.com/luexu/alog",
"github.com/luexu/aorm",
"github.com/luexu/code",
"github.com/luexu/dtype",
"github.com/microcosm-cc/bluemonday",
"github.com/modern-go/concurrent",
"github.com/modern-go/reflect2",
"github.com/ryanuber/columnize",
"github.com/shurcooL/sanitized_anchor_name",
"github.com/streadway/amqp",
"go/ast",
"go/build",
"go/doc",
"go/parser",
"go/scanner",
"go/token",
"golang.org/x/crypto/acme",
"golang.org/x/crypto/acme/autocert",
"golang.org/x/net/html",
"golang.org/x/net/html/atom",
"golang.org/x/net/idna",
"golang.org/x/net/publicsuffix",
"golang.org/x/text/secure/bidirule",
"golang.org/x/text/transform",
"golang.org/x/text/unicode/bidi",
"golang.org/x/text/unicode/norm",
"gopkg.in/ini.v1",
"gopkg.in/yaml.v2",
"hash",
"hash/adler32",
"hash/crc32",
"html",
"html/template",
"image",
"image/color",
"image/color/palette",
"image/draw",
"image/gif",
"image/internal/imageutil",
"image/jpeg",
"image/png",
"internal/bytealg",
"internal/cpu",
"internal/fmtsort",
"internal/goroot",
"internal/goversion",
"internal/lazyregexp",
"internal/nettrace",
"internal/oserror",
"internal/poll",
"internal/race",
"internal/reflectlite",
"internal/singleflight",
"internal/syscall/windows",
"internal/syscall/windows/registry",
"internal/syscall/windows/sysdll",
"internal/testlog",
"io",
"io/ioutil",
"log",
"math",
"math/big",
"math/bits",
"math/rand",
"mime",
"mime/multipart",
"mime/quotedprintable",
"net",
"net/http",
"net/http/cookiejar",
"net/http/httptrace",
"net/http/httputil",
"net/http/internal",
"net/textproto",
"net/url",
"os",
"os/exec",
"os/signal",
"os/user",
"path",
"path/filepath",
"project/luexu/app/cache",
"project/luexu/app/entity",
"project/luexu/app/model",
"project/luexu/app/module/bs/controller",
"project/luexu/app/module/bs/dto",
"project/luexu/app/module/bs/model",
"project/luexu/app/module/bs/vc",
"project/luexu/app/module/cms/controller",
"project/luexu/app/module/cms/dto",
"project/luexu/app/module/cms/model",
"project/luexu/app/module/cms/vc",
"project/luexu/app/module/ss/controller",
"project/luexu/app/module/ss/model",
"project/luexu/app/register",
"project/luexu/app/router",
"project/luexu/app/router/middleware",
"project/luexu/app/rservice",
"project/luexu/app/service",
"project/luexu/bootstrap",
"project/luexu/conf",
"project/luexu/console",
"project/luexu/driver",
"project/luexu/enum",
"project/luexu/helper",
"project/luexu/sdk/oas",
"project/luexu/sdk/weixin",
"reflect",
"regexp",
"regexp/syntax",
"runtime",
"runtime/debug",
"runtime/internal/atomic",
"runtime/internal/math",
"runtime/internal/sys",
"sort",
"strconv",
"strings",
"sync",
"sync/atomic",
"syscall",
"text/template",
"text/template/parse",
"time",
"unicode",
"unicode/utf16",
"unicode/utf8",
"unsafe",
"vendor/golang.org/x/crypto/chacha20poly1305",
"vendor/golang.org/x/crypto/cryptobyte",
"vendor/golang.org/x/crypto/cryptobyte/asn1",
"vendor/golang.org/x/crypto/curve25519",
"vendor/golang.org/x/crypto/hkdf",
"vendor/golang.org/x/crypto/internal/chacha20",
"vendor/golang.org/x/crypto/internal/subtle",
"vendor/golang.org/x/crypto/poly1305",
"vendor/golang.org/x/net/dns/dnsmessage",
"vendor/golang.org/x/net/http/httpguts",
"vendor/golang.org/x/net/http/httpproxy",
"vendor/golang.org/x/net/http2/hpack",
"vendor/golang.org/x/net/idna",
"vendor/golang.org/x/sys/cpu",
"vendor/golang.org/x/text/secure/bidirule",
"vendor/golang.org/x/text/transform",
"vendor/golang.org/x/text/unicode/bidi",
"vendor/golang.org/x/text/unicode/norm"
]
}
PS C:\Windows\system32>
@luexu: Can you try installing gopls
at master (GO111MODULE=on go get golang.org/x/tools/gopls@master golang.org/x/tools@master
) and see if you still see the same problems there? A lot has changed since gopls/v0.2.2
.
This issue has been closed automatically because it needs more information and has not had recent activity. Thank you for your contributions.
OS: windows 10 pro 64bit CPU: Intel(R) Core(TM) i5-9400F CPU @2.9GHz 2.90GHz RAM: 16GB vscode: 1.40.2 go version: go1.13.4 windows/amd64
setting.json
go env
gopls version
auto complete dosen't work!!! It'll remove some useful code after saving( when the option go.userLanguageServer is true.
Sometimes Vscode doesn't import existing packages. Sometimes Vscode doesn't show intelligence code suggestions Linting gets super slow