Skip to content

x/tools/gopls: 'imports' does not seem to prefer current major version import path. #60824

Closed as not planned
@andydotxyz

Description

@andydotxyz

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.20.3
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • Build info

golang.org/x/tools/gopls v0.11.0
golang.org/x/tools/[email protected] h1:/nvKHdTtePQmrv9XN3gIUN9MOdUrKzO/dcqgbG6x8EY=
github.com/BurntSushi/[email protected] h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
github.com/google/[email protected] h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/[email protected] h1:QfTh0HpN6hlw6D3vu8DAwC8pBIwikq0AI1evdm+FksE=
golang.org/x/exp/[email protected] h1:fl8k2zg28yA23264d82M4dp+YlJ3ngDcpuB1bewkQi4=
golang.org/x/[email protected] h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
golang.org/x/[email protected] h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/[email protected] h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/[email protected] h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/[email protected] h1:7/HkGkN/2ktghBCSRRgp31wAww4syfsW52tj7yirjWk=
golang.org/x/[email protected] h1:qptQiQwEpETwDiz85LKtChqif9xhVkAm8Nhxs0xnTww=
honnef.co/go/[email protected] h1:oDx7VAwstgpYpb3wv0oxiZlxY+foCpRAwY7Vk6XpAgA=
mvdan.cc/[email protected] h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
mvdan.cc/xurls/[email protected] h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.20.3

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

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

    • 0.38.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/andy/.go
      GOROOT: /opt/homebrew/Cellar/go/1.20.3/libexec
      PATH: /opt/homebrew/opt/ruby/bin:/opt/homebrew/opt/openjdk/bin:/Users/andy/.go/bin:/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin

    go: /opt/homebrew/bin/go: go version go1.20.3 darwin/arm64

    gotests: not installed
    gomodifytags: not installed
    impl: not installed
    goplay: not installed
    dlv: /Users/andy/.go/bin/dlv (version: v1.20.2 built with go: go1.20.3)
    staticcheck: not installed
    gopls: /Users/andy/.go/bin/gopls (version: v0.11.0 built with go: go1.20.3)

go env
Workspace Folder (2-packinglist): /Users/andy/Code/FyneLabs/Udemy-FyneBeginner/2-packinglist
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/andy/Library/Caches/go-build"
GOENV="/Users/andy/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/andy/.go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/andy/.go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.20.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.20.3/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.20.3"
GCCGO="gccgo"
AR="ar"
CC="cc"
CXX="c++"
CGO_ENABLED="1"
GOMOD="/Users/andy/Code/FyneLabs/Udemy-FyneBeginner/2-packinglist/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/pc/1mt578kn6615qkxsygpwrw7m0000gn/T/go-build4076799024=/tmp/go-build -gno-record-gcc-switches -fno-common"

Share the Go related settings you have added/edited

Just the generic AutoSave = onFocusChange

Describe the bug

The Go import suggestion (auto-adding) does not seem to realise that a project is using v2 import path once server has a breaking change beyond v0/1

Steps to reproduce the behavior:

  1. Create a new project with go module etc
  2. Import "fyne.io/fyne/v2/app"
  3. Add a := app.New() into a main() function
  4. Save and all should be well
  5. Now type something like dialog.NewError and save to trigger import generation
  6. Notice that the import is not v2. On some versions it inserts "fyne.io/fyne/dialog" which is not compatible (old v1 api) - though after a recent update it is making up an import path of "fyne.io/fyne/v2/rc1/dialog" which has never been used.

Screenshots or recordings

Screenshot 2023-06-12 at 10 49 26

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions