Go&VScode 개발 Debug 환경 구축
준비
우선 GO의 공식 사이트에서 설치합니다.
https://golang.org/dl/
설치가 완료되면 시스템 환경 변수에
c:\go\bin
를 추가합니다.그리고 vscode에 GO의 확장 기능을 추가합니다.
그리고 vscode에서 F1을 누르고 나오는 패널에
입력
Go: Install/Update tools
모두 확인하고 설치합니다.
Hello World
main.go
package main
import (
"fmt"
)
func main() {
fmt.Print("Hello world")
}
Ctrl+Shift+B로 실행합니다.처음 실행했을 때는tasks였다.json을 설정해야 합니다.{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "run",
"type": "shell",
"command": "go",
"args": [
"run",
"${file}"
]
}
]
}
배치가 완료되면 Hello World를 실행할 수 있습니다.Debug
아까
Go: Install/Update tools
때 dlv
들어갔으면 F5만 누르면 디버그 모드로 들어갈 수 있었어요.만약 당신이 설치하지 않았다면 dlv
, 당신은 수동으로 설치해야 합니다.https://github.com/go-delve/delve/tree/master/Documentation/installation
↑ 구체적인 설치 방법
https://github.com/Microsoft/vscode-go/wiki/Debugging-Go-code-using-VS-Code
설치 후 launch.json을 설정하면 Debug 할 수 있습니다.
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"env": {},
"args": []
}
]
}
Reference
이 문제에 관하여(Go&VScode 개발 Debug 환경 구축), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/NEGO/items/306e2a135fbae9b84d29텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)