0
1

More than 3 years have passed since last update.

Goの学習備忘録 #1 環境設定とデバッグ

Posted at

環境設定

Goをインストール for mac

https://golang.org/
からダウンロード

terminalからgoを実行
command not foundの場合、terminalを再起動
それでもダメな場合、PATHを通す

export GOPATH="$HOME/go"
export PATH="$GOPATH/go//bin/:$PATH"

パッケージをインストールしてみる

Goのドキュメントを見れるパッケージ
bash
$ go get golang.org/x/tools/cmd/godoc

https://godoc.org/golang.org/x/tools/cmd/godoc

$ godoc fmt

# go doc fmt.Printfにコマンドが現在では変更されているらしい

VSCodeでのデバッグのしかた

delveをインストール

$ go get -u github.com/derekparker/delve/cmd/dlv

VSCodeでGoの定義元に飛ぶ

// settings.json

"go.useLanguageServer": true
0
1
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
0
1