答案 0 :(得分:0)
我找到了解决这个问题的方法:
错误信息实际上不是由 VScode 引起的,而是由 golang 扩展引起的。
要禁用它,您必须转到扩展管理器并单击已安装扩展旁边的小齿轮,然后从上下文菜单中将其恢复为以前的版本。我恢复的版本是大约一年前的。
如果您没有看到小齿轮图标,则需要先安装扩展程序。
答案 1 :(得分:0)
将您的 main.go 文件路径添加到位于 launch.json 文件中的“程序”属性。
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "E:/GoProjects/main.go",
"env": {},
"args": []
}
]
}