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

x/tools/internal/lsp: can't find import #29311

Closed
OneOfOne opened this issue Dec 17, 2018 · 3 comments
Closed

x/tools/internal/lsp: can't find import #29311

OneOfOne opened this issue Dec 17, 2018 · 3 comments

Comments

@OneOfOne
Copy link
Contributor

What version of Go are you using (go version)?

┏━ oneofone@Ava ❰~❱
┗━● go version
go version devel +dbd323bb88 2018-12-14 18:15:56 +0000 linux/amd64
┏━ oneofone@Ava ❰~❱
┗━● git -C $GOPATH/src/golang.org/x/tools describe --always
57eff0d8

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
┏━ oneofone@Ava ❰~❱ 
┗━● go env
GOARCH="amd64"
GOBIN="/home/oneofone/code/go/bin"
GOCACHE="/tmp/.gocache"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/oneofone/code/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/src/go"
GOTMPDIR=""
GOTOOLDIR="/usr/src/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
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-build911290659=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Working on a rather large workspace in vscode + vscode-go 0.8.0 + latest golsp as of 10 mins ago, I keep getting can't find import on "one" specific internal package.

However, it works fine except for printing that error (and marking the import as an error in the editor), it auto completes the package and types in it just fine.

Deleting the $GOCACHE folder doesn't change anything.

Editor config

	"go.alternateTools": {
		"go-langserver": "golsp"
	},
	"go.useLanguageServer": true,
	"go.languageServerExperimentalFeatures": {
		"format": true,
		"autoComplete": true,
		"rename": true,
		"goToDefinition": true,
		"hover": true,
		"signatureHelp": true,
		"goToTypeDefinition": true,
		"goToImplementation": true,
		"documentSymbols": true,
		"workspaceSymbols": true,
		"findReferences": true
	},

What did you expect to see?

No errors.

What did you see instead?

[Trace - 11:57:57 PM] Sending request 'textDocument/codeAction - (65)'.
Params: {"textDocument":{"uri":"file:///home/oneofone/code/go/src/github.com/PRIVATE/service/service.go"},"range":{"start":{"line":21,"character":2},"end":{"line":21,"character":2}},"context":{"diagnostics":[{"range":{"start":{"line":21,"character":2},"end":{"line":21,"character":2}},"message":"could not import github.com/PRIVATE/internal/hose (can't find import: \"github.com/PRIVATE/internal/hose\")","severity":1,"source":"go"}]}}
@gopherbot gopherbot added this to the Unreleased milestone Dec 17, 2018
@OneOfOne
Copy link
Contributor Author

@ramya-rao-a @stamblerre

@stamblerre
Copy link
Contributor

@OneOfOne: this sounds like a diagnostic being generated by the VSCode-Go extension - if you notice, the "source" is set to "go", whereas golsp always sets the source to "LSP" (https://github.com/golang/tools/blob/ae5b88167698f5f718baac67cf6088827de6569f/internal/lsp/diagnostics.go#L53). You can look at the diagnostics that golsp is sending by looking for the "publishDiagnostics" messages in the logs.

@OneOfOne
Copy link
Contributor Author

It looks like that got fixed by "go.buildOnSave": "package", I had it set to off.

@golang golang locked and limited conversation to collaborators Dec 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants