为什么在保存时,VSCode会删除Golang脚本?

huangapple go评论84阅读模式
英文:

Why vscode removes golang script when doing save

问题

我在保存我的Golang项目时遇到了问题,当我想要导入"fmt"时,保存"fmt"脚本后它就消失了。那么我该如何解决呢?

setting.json(vscode):

{
	"workbench.startupEditor" : "newUntitledFile",
	"workbench.iconTheme" : "vscode-icons",
	"security.workspace.trust.untrustedFiles":"open",
	"editor.suggestSelection" : "first",
	"vsintelllicode.modify.editor.suggestSelection":"automatically",
	"workbench.colorTheme":"Material Theme Ocean",
	"vsicons.dontShowNewVersionMessage":"true"
}
英文:

I'm having trouble here when I want to save my golang project, where when I want to import "fmt" then I save the "fmt" script it disappears. then how do i fix it

setting.json (vscode) :

{
	"workbench.startupEditor" : "newUntitledFile",
	"workbench.iconTheme" : "vscode-icons",
	"security.workspace.trust.untrustedFiles": "open",
	"editor.suggestSelection" : "first",
	"vsintelllicode.modify.editor.suggestSelection":"automatically",
	"workbench.colorTheme":"Material Theme Ocean",
	"vsicons.dontShowNewVersionMessage":"true"
}

答案1

得分: 2

通常情况下,您不需要手动添加导入语句。您可以编写fmt.Println(1),然后查看它是否保留。

英文:

You usually don't need to manually add imports. Write fmt.Println(1) and see if it keeps it.

huangapple
  • 本文由 发表于 2022年2月24日 16:37:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/71249173.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定