How to exclude outdated package version in generated imports? #3613
Unanswered
ErikKalkoken
asked this question in
Help
Replies: 2 comments 5 replies
-
@ErikKalkoken "go.useLanguageServer": true,
"gopls": {
"allowModfileModifications": true,
"allowImplicitNetworkAccess": true
} This makes gopls automatically fix outdated imports when you run go mod tidy in VS Code. After that you execute: go get -u ./...
go mod tidy With that, all dependencies are updated to the latest stable versions. And last : gopls fix ./... If imports are still outdated, force VS Code to reformat them. |
Beta Was this translation helpful? Give feedback.
2 replies
-
I tried this, but I get an "invalid option" error for Do I maybe need a special version?I am running Go extension v0.44.0 with Go 1.23.4. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I use a new package the import statements for that package are added automatically, which is a great and helpful feature.
However, when there is a v2 version of that package the plugin still always adds the v1 version. This can lead to errors by accidentally using an outdated package version in your code or at least always always requires me to manually update the import statement to the newer version.
I there a way to exclude outdated versions in generated imports?
Beta Was this translation helpful? Give feedback.
All reactions