LoginSignup
22
16

More than 5 years have passed since last update.

IntelliJ CE + Delve で Go 言語のデバッグ環境構築(Mac)

Last updated at Posted at 2016-08-18

注意

golang 用 IDE の GoLand が正式リリースされ、下記の手順は無効となりました(プラグインが無償提供されなくなった模様)。

概要

無償提供されている IntelliJ Community EditionDelve で golang のデバッグ環境を macOS 上に構築します。

IntelliJ Community Edition インストール

IntelliJ Community Edition をダウンロードしてインストールする。

Go プラグインインストール

IntelliJ -> Preference -> Plugins -> Browse repositories で Go を検索して Go のプラグインをインストールする。
スクリーンショット 2016-08-18 15.00.27.png

Delve インストール

Homebrew でインストールする。
brew install go-delve/delve/delve

デバッグ設定

IntelliJ -> Run -> Edit Configurations
左上 + をクリックして Go Application を選択する。
Name に任意の名前を入力し、File に main 関数を含むソースコードを指定して OK ボタンをクリックする。
スクリーンショット 2016-08-18 15.48.08.png

デバッグ実行

任意の場所にブレークポイントをはり、
IntelliJ -> Run -> Debug から先ほど作成した設定を選択する。
OSXのパスワード入力を求められるので入力すると無事デバッグできるようになっている。
2016_08_18_16_01.png

22
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
16