Re:Go 1.17 Release Notes
by hakube on Monday August 16, 2021 @07:56PM
(#28204436)
How do you add dependencies and in Go? I'm still confused. I use the VSCode extension and the code I wrote that uses external packages gets deleted when I save my file even though the package is installed
[ Parent
| on HN ]
Re:Go 1.17 Release Notes
by jizzlepizzle on Monday August 16, 2021 @08:08PM
(#28204528)
the vscode extension automatically formats your go file and removes any packages that aren't used in the code.
Re:Go 1.17 Release Notes
by galleywest on Monday August 16, 2021 @08:03PM
(#28204487)
Are you using the imports in your file? The VS Code Go addon has "format on save" enabled by default and Go will not compile if there are unused imports - so VS Code deletes the unused imports on save by default.
Otherwise try a "go mod init" in the root of your project.