Skip to content

x/tools/gopls: inaccurate diagnostics after switching branches #52499

@rohan-rayaraddi

Description

@rohan-rayaraddi

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

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.

    • 1.17.6
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.

    • gopls v0.8.2
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.

    • 1.66.0
  • Check your installed extensions to get the version of the VS Code Go extension

    • v0.32.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

    • Checking configured tools....
      GOBIN: undefined
      toolsGopath:
      gopath: /Users/rohan.rayaraddi/go
      GOROOT: /usr/local/go
      PATH: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Users/rohan.rayaraddi/bin:/Users/rohan.rayaraddi/go/bin

    go: /usr/local/go/bin/go: go version go1.17.6 darwin/amd64

    go-outline: /Users/rohan.rayaraddi/go/bin/go-outline (version: unknown - )
    gotests: /Users/rohan.rayaraddi/go/bin/gotests (version: unknown - )
    gomodifytags: /Users/rohan.rayaraddi/go/bin/gomodifytags (version: unknown - )
    impl: /Users/rohan.rayaraddi/go/bin/impl (version: unknown - )
    goplay: /Users/rohan.rayaraddi/go/bin/goplay (version: unknown - )
    dlv: /Users/rohan.rayaraddi/go/bin/dlv (version: unknown - )
    staticcheck: /Users/rohan.rayaraddi/go/bin/staticcheck (version: unknown - )
    gopls: /Users/rohan.rayaraddi/go/bin/gopls (version: unknown - )

go env
Workspace Folder (nutanix-era-cloud-service): /Users/rohan.rayaraddi/nutanix-era-cloud-service
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/rohan.rayaraddi/Library/Caches/go-build"
GOENV="/Users/rohan.rayaraddi/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/rohan.rayaraddi/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/rohan.rayaraddi/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.6"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/9d/z94gzxxn5nl209kz5ylyp0s40000gp/T/go-build977718275=/tmp/go-build -gno-record-gcc-switches -fno-common"

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

Describe the bug

Say file f1 has a struct MyStruct on branch main. f1 was renamed to f2 in branch feature and then you checkout main branch, main shows an error than Mystruct is declared twice in f1 and f2, when infact f2 does not exist in the main branch

Steps to reproduce the behavior:

described above
microsoft/vscode#147326

Screenshots or recordings

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.goplsIssues related to the Go language server, gopls.gopls/metadataIssues related to metadata loading in gopls

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions