-4

I'm learning golang with latest VSCode, golang plugin and latest golang version.

Goland doesnt let you have unused stuff - for example variable and imports.

Is there a way in VSCode to bypass that?

Thank you :)

nadavgam
  • 2,014
  • 5
  • 20
  • 48
  • 3
    This isn't a VSCode thing, per se. It's part of the standard Go toolchain.. Why do you want unused things? – Jonathan Hall May 09 '19 at 14:05
  • 2
    Golang project won't build or run if there are unused variables or imports in your project, hence why VS Code removes them. If you're altering code and saving often, maybe think about commenting out lines instead as commented code isn't removed. – tgrobinson May 09 '19 at 14:07

2 Answers2

1

You need to comment that out. The go toolchain won't allow you to keep it and that's a good thing.

ND003
  • 726
  • 1
  • 8
  • 22
-2

vs code only removes / adds imports / variables after saving the file so not saving while the variables are not used should solve the problem.

If this is not the case for you you should be able to change this in the settings menu.