MINGKYME 블로그

Golang M1 Mac VSCode Debug

M1 Mac Air, Monterey OS 기준으로 테스트 했습니다

Go 설치

https://golang.org/dl/

VS Code 설치

기존의 설치 방법은 Universal version 다운로드해서 진행했었지만, 이게 나에게 큰 난관을 불러왔다.

꼭 Apple Silicon version으로 다운해야한다.

https://code.visualstudio.com/ 접속 Other platforms 클릭 Apple Silicon 다운로드

응용 프로그램 폴더에 넣기

Debugger 다운

Command Shift P go install/Update Tools dlv, dlv-dap 설치

.vscode/launch.json

{
    // IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
    // 기존 특성에 대한 설명을 보려면 가리킵니다.
    // 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${fileDirname}"
        }
    ]
}

완료