go: x/tools/gopls: import organization sporadically failing

What did you do?

Added a reference to a package in my project and hit “save” in VSCode.

What did you expect to see?

Import should be added automatically.

What did you see instead?

Nothing happened.

More information

This is a regression that appears to have been introduced in 0.4.0. I have no idea how to reproduce it, though it seems to happen > 50% of the time now. Project is building fine when this occurs.

Log looks normal (I am inserting a utils.Spew() function here): gopls.log.gz.

Also tested latest master.

Build info

golang.org/x/tools/gopls 0.4.0
    golang.org/x/tools/gopls@(devel)
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/mod@v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
    golang.org/x/sync@v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
    golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea => ../
    golang.org/x/xerrors@v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
    honnef.co/go/tools@v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
    mvdan.cc/xurls/v2@v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=

Go info

go version go1.14 darwin/amd64

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 33 (14 by maintainers)

Most upvoted comments

Thanks for the repro. Somehow -tags=dummy is turning into just -tags and breaking all of our go invocations. I’ll track it down.