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
When starting to use a new package in a Go source file, the plugin (automatically) adds an import path to an identically named package that is not available in my go.mod file. This happens even though my project is already using the package/import path I want in other files (and thus is already in my go.mod). That is, the plugin is not able to recognize an existing import path for the package, but instead appears to pick an import path at random.
I would expect that the plugin would prioritize to use the import path of the package already available in go.mod.
Steps to reproduce the behavior:
Write a new function that returns a proto.Message type.
Save the file.
Watch the import section be augmented with "go.starlark.net/lib/proto"
Run grep -R 'go.starlark.net/lib/proto' * and observe that the entire project makes no mention of this import path.
Run grep -R 'google.golang.org/protobuf/proto' * | wc -l and observe that the project is using this import path in 11 files.
See screenshots below
Screenshots or recordings
The text was updated successfully, but these errors were encountered:
changed the title
gopls: picks random import path not in go.mod when wanted import path for package is in go.modJul 6, 2023