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/gopls: didConfigurationChange does not trigger recalculation of diagnostics #35548

Closed
myitcv opened this issue Nov 12, 2019 · 1 comment
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@myitcv
Copy link
Member

myitcv commented Nov 12, 2019

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

$ go version
go version devel +99957b6930 Tue Nov 12 05:35:33 2019 +0000 linux/amd64
$ go list -m golang.org/x/tools
golang.org/x/tools v0.0.0-20191112184959-323f198cedfe
$ go list -m golang.org/x/tools/gopls
golang.org/x/tools/gopls v0.1.8-0.20191112184959-323f198cedfe

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="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/myitcv/.cache/go-build"
GOENV="/home/myitcv/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/myitcv/gos"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/myitcv/gostuff/src/github.com/myitcv/govim/go.mod"
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-build837961649=/tmp/go-build -gno-record-gcc-switches"

What did you do?

govim/govim#583 introduces support in govim to set the "env" configuration that is used by gopls. It builds on the didConfigurationChange support added in https://go-review.googlesource.com/c/tools/+/206148.

The test added as part of govim/govim#583 aims to change the environment variable GOFLAGS whilst govim and gopls are running in order to verify that diagnostics etc update accordingly.

The files involved in the test are main.go:

package main

func main() {
	DoIt()
}

and other.go:

// +build other

package main

func DoIt() {
}

govim (and hence gopls) is initially started with no environment. Hence we expect to receive the diagnostic equivalent to:

main.go|4 col 2| undeclared name: DoIt

We receive this diagnostic so all is good.

Then we change the gopls environment, setting GOFLAGS=-tags=other. At this point we wait to receive updated diagnostics to verify that there are no longer any diagnostics for main.go (because the constraint in other.go is now satisfied)

However we do not receive any updated diagnostics, and hence the govim test fails.

gopls log as follows:

gopls.log

What did you expect to see?

Updated diagnostics to be sent when config is changed that might influence that set of diagnostics.

What did you see instead?

No update in diagnostics. Similarly I do not see staticcheck analyses being run if I change the staticcheck config from off to on.


cc @stamblerre @ianthehat

@myitcv myitcv added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. gopls Issues related to the Go language server, gopls. labels Nov 12, 2019
@gopherbot gopherbot added this to the Unreleased milestone Nov 12, 2019
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Nov 12, 2019
myitcv added a commit to govim/govim that referenced this issue Nov 25, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.
myitcv added a commit to govim/govim that referenced this issue Nov 25, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Nov 25, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Nov 25, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Nov 26, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Nov 26, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Nov 27, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Nov 27, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Dec 2, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Dec 2, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Dec 2, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
@gopherbot
Copy link

Change https://golang.org/cl/209418 mentions this issue: internal/lsp: return snapshot when creating a view

@stamblerre stamblerre modified the milestones: Unreleased, gopls v1.0 Dec 4, 2019
myitcv added a commit to govim/govim that referenced this issue Dec 5, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Dec 5, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Dec 7, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Dec 7, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Dec 8, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Dec 8, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Dec 9, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Dec 9, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Dec 9, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Dec 16, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Dec 16, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Dec 16, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Dec 16, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Dec 20, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Dec 20, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to myitcvforks/govim that referenced this issue Dec 22, 2019
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes govim#555
myitcv added a commit to myitcvforks/govim that referenced this issue Dec 22, 2019
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Jan 23, 2020
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Jan 23, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Jan 26, 2020
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Jan 26, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Jan 26, 2020
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Jan 26, 2020
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Jan 26, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Jan 27, 2020
gopls can be configured with an environment, an environment which is
passed to go/packages. For example, setting GOOS and GOARCH, or setting
GOFLAGS=-tags=other to set a build tag.

Therefore we define a govim config key, "GoplsEnv", for setting this
environment.

For example:

  govim#config#Set("GoplsEnv", {"GOFLAGS": "-mod=readonly"})

As part of this add a test that verifies the behaviour of the above
setting. Setting of build tags does not current work; that is blocked on
golang/go#35548 and will be tested in a follow
up PR.

Fixes #555
myitcv added a commit to govim/govim that referenced this issue Jan 27, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Jan 28, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Jan 28, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Jan 29, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Jan 30, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Jan 30, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Jan 30, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Feb 1, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Feb 1, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
myitcv added a commit to govim/govim that referenced this issue Feb 10, 2020
We currently support the setting of GOFLAGS with values like
-mod=readonly. But because of golang/go#35548
have been unable to supported (in a tested way) the setting of build
tags as part of GOFLAGS.

Add such a test to verify the gopls fix works.
@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.4.0 Jul 22, 2020
@golang golang locked and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants