4 ms·
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
by hakube 5y ago
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
- galleywest 5y agoAre 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.
- jizzlepizzle 5y agothe vscode extension automatically formats your go file and removes any packages that aren't used in the code. https://code.visualstudio.com/docs/languages/go#_formatting https://code.visualstudio.com/docs/languages/go#_formatting