You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
In a project that uses go modules, vscode caches the paths to each library that is specified in the go.mod file on startup. When altering the go.mod file by e.g. go get the cache is not updated. Meaning that on lookup (e.g. go to definition) you'll be directed to the old path/library.
Only after a restart of the editor it'll be reloaded -- because it's always doing it on startup only as mentioned.
Steps to Reproduce:
Create a go project that relies on modules and is outside of your GOPATH
Lookup the implementation for one specific library (if you have breadcrumbs enabled you can see the path to the version)
Downgrade the library via go get <lib path>@<version>
Do a lookup again
You should see the previous implementation (if you have breadcrumbs enabled you can see the path to the version)
Thanks for reporting @alloro and apologies for the delay in responding.
The extension caches 2 maps related to modules.
Folder of the file opened in VS Code -> Path to the go.mod file for the package in this folder
Folder of the file opened in VS Code -> Import path to the package in this folder
We do not cache the paths to each library in the go.mod file
Therefore, it looks like the problem is with the tool used for doing the lookup.
If you are not using the language server, then the tool that gets used is godef
Can you run the Go: Install/Update Tools , select godef and gopls , press Ok to update them and try again both with and without the language server? If you still see the issue then we need to redirect the issue to godef/gopls
The key is the folder path of the file that was opened in VS Code. The value is the path to the go.mod file
gopls does not yet actually handle the contents of go.mod files, so when your go.mod file changes, we do not update our caches. This is tracked upstream here: golang/go#31999.
In a project that uses go modules, vscode caches the paths to each library that is specified in the
go.mod
file on startup. When altering the go.mod file by e.g.go get
the cache is not updated. Meaning that on lookup (e.g. go to definition) you'll be directed to the old path/library.Only after a restart of the editor it'll be reloaded -- because it's always doing it on startup only as mentioned.
Steps to Reproduce:
go get <lib path>@<version>
Possible Section in the Code
To mention:
The text was updated successfully, but these errors were encountered: