我有一個文件夾 D:\Data\Git\go\src\demo ,其中包含一個文件 main.go。我已經安裝了go1.12.6 windows/amd64。(我運行的是 Windows 10)我無法調試應用程序 - 調試器在屏幕上閃爍然后消失 ==> 什么也沒有發生 ==> 即使我設置了斷點,它也不會中斷交互式步驟的代碼 -通過!我可以從命令行運行應用程序 ==> go run main.go (當前目錄是 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": "${fileDirname}", "env": {}, "args": [] } ]}這是我的應用程序:package mainimport "fmt"func main() { s := []int{2, 3, 5, 7, 11, 13} s = s[1:4] fmt.Println(s)}如何在 VS Code 中進行調試?
1 回答

catspeake
TA貢獻1111條經驗 獲得超0個贊
答案如下:
Ctrl+Shift+P ==> 打開 Launch.json ==> 保存 ==> 瞧!
(它有效。我現在可以使用 Visual Studio Code 中的一個 main.go 文件單步調試并調試一個簡單的應用程序)
- 1 回答
- 0 關注
- 161 瀏覽
添加回答
舉報
0/150
提交
取消