Skip to content

Instantly share code, notes, and snippets.

@devlights
Last active October 19, 2016 07:37
Show Gist options
  • Select an option

  • Save devlights/8e7b647a585879f3cd039f06d9d18c3d to your computer and use it in GitHub Desktop.

Select an option

Save devlights/8e7b647a585879f3cd039f06d9d18c3d to your computer and use it in GitHub Desktop.
Visual Studio CodeでGo言語を使えるようにする。(Windows)
  • Go言語のWindows版をDownloadしてインストール
  • GOPATHを環境変数に
  • Visual Studio Codeを起動
  • 「言語モードの選択」にてGoを選択
  • 必要なツールをダウンロードするかどうかのトーストがでるのでInstall ALL選択
    • 注意点として、予めGitがインストール済みで環境変数PATHに通っていないと成功しない。
  • CTRL+@でターミナルを開いて、以下のコマンドでDELVEをインストール
    • go get github.com/derekparker/delve/cmd/dlv
  • どれでもいいのでgoファイルを作って、F5押下
    • launch.jsonが出来上がるので再度F5押下
  • うまく実行できたらOK.ブレークポイントも効く。
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "start",
"isShellCommand": true,
"tasks": [
{
"taskName": "\"go run\"",
"args": [
"cmd",
"/k",
"go",
"run",
"${file}"
],
"showOutput": "never"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment