Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't autocomplete,gocode debug can't find import package #789

Closed
ymakedaq opened this issue Oct 15, 2020 · 7 comments
Closed

Can't autocomplete,gocode debug can't find import package #789

ymakedaq opened this issue Oct 15, 2020 · 7 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@ymakedaq
Copy link

ymakedaq commented Oct 15, 2020

Please direct general questions to:

Please review the documentation before filing an issue.
Helpful pages include:

Please answer these questions before submitting your issue. Thanks!

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go
    • go version go1.15.2 linux/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • September 2020 (version 1.50)
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.17.2
  • Run go env to get the go development environment details
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build111005529=/tmp/go-build -gno-record-gcc-switches"

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.

{
    "go.inferGopath": false,
    "go.gopath": "/data/project/cmdb",
    "go.autocompleteUnimportedPackages": true,
    "go.goroot": "/usr/local/go",
    "go.formatTool": "goimports",
    "go.toolsGopath": "/data/gotools_gopath/bin/",
    "go.gotoSymbol.includeImports": true,
    "go.useCodeSnippetsOnFunctionSuggest": true,
    // "go.useLanguageServer": true,
}

Describe the bug

Can't autocomplete
gocode debug gbimporter: no package found for github.com/ServiceComb/go-chassis/core/lager: can't find import
,variables prompt invaild type.
My vendor package is ok, build success

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. See error

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.

@hyangah
Copy link
Contributor

hyangah commented Oct 15, 2020

@MakeYuan-Driver Can you please share the output of Go: Locate Configured Go Tools command?
It's accessible from the command palette (Cmd+Shift+P or Ctrl+Shift+P).

Do you have the same issue if you turn on the language server? ("go.useLanguageServer": true)

@taman9333
Copy link

I have same problem when commenting this line "go.useLanguageServer": true it works properly but it can't auto-complete package itself however auto-completing functions inside package works properly.

if I enable this line & remove commenting it auto-complete the package itself but then shows can't find import package & can't auto-complete any of the functions inside this package

@stamblerre
Copy link
Contributor

@taman9333: Do you mind filing a new issue and filling out the issue template? It will be easier to help you that way. Also, please take a look at the troubleshooting instructions for the language server: https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md.

@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Oct 21, 2020
@dzpt
Copy link

dzpt commented Dec 1, 2020

Same issue, can't suggest methods from vendor packages.
But still clickable to the methods

@dzpt
Copy link

dzpt commented Dec 1, 2020

@taman9333 have you solved the trouble yet?

@stamblerre
Copy link
Contributor

@dzpt: Please open a new issue if you're encountering problems. Thanks!

@dzpt
Copy link

dzpt commented Dec 2, 2020

@stamblerre i solved the trouble by this golang/go#37962

@golang golang locked and limited conversation to collaborators Dec 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

6 participants