exported identifier propagation when writing Go in Visual Studio Go with go.mod replace

31 views Asked by At

When editing multiple Go modules in Visual studio Code and using replace in go.mod to reference other modules via the instantly updating file system instead of using the outdated published package version

When updates in the replaced module are saved to the file system, the Visual Studio Code window for the referring module does not receive those updates unless Visual Studio Code is restarted. Say a new identifier is exported or the signature of a function is changed

typically, each module has its own Visual Studio Code window opened at go.mod locations — modules are referencing each other using go.work in a directed graph as well as via imports

Can Visual Studio Code somehow notice those updates automatically?

Is there some easier way than restarting Visual Studio Code to update the exported identifiers?

  • go version go1.21.6 darwin/arm64

  • Visual Studio Code Version: 1.85.2

.

.

More information January 23 2024:

Changing the name of a public identifier:

  • updates the identifier in the source code across all Code windows and Go modules
  • syntax check by gopls is not updated, ie. the changed new identifier is now a syntax error in Code windows other than where the change was made, ie. in another Go module

This indicates trouble in gopls or Go extension for Visual Studio Code

0

There are 0 answers