Closed yudai closed 5 years ago
I'm not sure if there is any side effect by this change. It looks working on my env though.
@yudai @saibing I have found case where it breaks bingo on my project (files in nested module like in #2). I'll fix it in another PR.
What's Observed
Bingo returns errors when I open files in the $GOPATH/pkg/mod directory (on Emacs with lsp-mode).
For example, textDocument/hover requests fail with the following error message:
Root Cause
The command
go [list -f {{context.GOARCH}} {{context.Compiler}} -- unsafe
is executed byGetSizesGolist()
in golang.org/x/tools: https://github.com/golang/tools/blob/79186431cf2917562ba2e632326924b5594ce114/go/internal/packagesdriver/sizes.go#L81The
go list
command actually fails alone if you run it on the directory of a non-moduled (no go.mod) dependency package.It seems
go list
tries to creatego.md
whenGO111MODULE
is on even if you are inpkg/mod
. However since directories inpkg/mod
are read only, the command always fails. I’m not sure if this behavior itself is correct (go list
should not try to convert packages to modules inpkg/mod
even when MODULE is on?), but anyway it won’t work inpkg/mod
now. ThisGetSizesGoList()
is called frompackages.Load()
and it’s originated from*View.parse()
incache/view.go
. We currently setpath
tov.Config.Dir
, that makes thego list
command run inpath
and causes the error above.Fix
We don’t need to set
v.Config.Dir
. The go command will be run in the current working directory and that just works.