Description
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.- go version go1.19.3 linux/amd64
-
Run
gopls -v version
to get version of Gopls from the VS Code integrated terminal.- golang.org/x/tools/[email protected] h1:Q0cfPbEG1WVfgxcRZ9uKTA6/ckIRNXx6Ym7KgT/VFE4=
-
Run
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.- 1.80.2
2ccd690cbff1569e4a83d7c43d45101f817401dc
x64
- 1.80.2
-
Check your installed extensions to get the version of the VS Code Go extension
- v0.39.1
Share the Go related settings you have added/edited
Describe the bug
If you want to add a completely new module which has never been used in a project, you must go get...
Meanwhile, that command seems to inspect the code to determine what's referenced. If you try and add a reference to the module, you "can't" because every time you add the import and hit save, the reformatter nukes the import because nothing uses it. If you do the go get before you add the import, the module ends up //indirect and in go.sum it's commented out.
I ended up having to break out to emacs, add the import, then go get & go mod tidy/vendor/etc before things started working correctly.
Steps to reproduce the behavior:
See above.
Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.