菜单栏Tasks->Configure Tasks
{ "version": "2.0.0", "tasks": [ { "label": "Build logic", "type": "shell", "command": "go build src/service/main.go", "group": { "kind": "build", "isDefault": true }, "problemMatcher":{ "owner": "go", "fileLocation": [ "relative", "${fileDirname}" ], "pattern": { "regexp": "^(.*):(\d+):\s+(.*)$", "file":1, "line": 2, "message": 3 } } } ] }
vscode编译快捷键 ctrl+shitf+b