Open
Description
What version of Go are you using (go version
)?
$ go version go version go1.14.7 darwin/amd64
# gopls version golang.org/x/tools/gopls 0.4.4 golang.org/x/tools/gopls@v0.4.4 h1:8djGYsaZ0ByP0vaXg4T+mnyfDcHpWKSZ+tpQSGv9ahk=
VS Code version v1.47.3
vscode-go v0.16.1
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/segev/Library/Caches/go-build" GOENV="/Users/segev/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/segev/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/Cellar/go/1.14.7/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.14.7/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" 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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/b_/c6yh0ksn63d1yy192x2p9f4c0000gn/T/go-build425202633=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
- Create two new packages using Go modules:
mkdir foo && cd foo go mod init github.com/segevfiner/foo cd .. mkdir bar && cd bar go mod init github.com/segevfiner/bar cd ..
- Open VS Code with vscode-go installed and gopls enabled:
code foo bar
- Add
replace github.com/segevfiner/bar => ../bar
to modulefoo
's go.mod. - Add to module
foo
asmain.go
:package main func main() { }
- Add to module
bar
asbar1.go
:package bar func Bar1() { }
- Try to add
foo.Bar1()
tofoo
'smain.go
, it would work and also auto complete it. (Might need to manually add the import statement) - Add to module
bar
asbar2.go
:package bar func Bar2() { }
- Try to add
foo.Bar2()
tofoo
'smain.go
, it would not autocomplete and will fail to compile until you restart the language server.
What did you expect to see?
Adding new files to replaced packages should work seamlessly, auto-completing, compiling correctly, without requiring a restart of the language server.
What did you see instead?
It fails to auto-complete, compile etc. (While working correctly with go build
) until you restart the language server.