LoginSignup
2
0

More than 3 years have passed since last update.

Go言語インストール後の実行環境テスト

Posted at

最終確認

インストール、Version確認後
VSCordでフォルダを作成し、期待する結果が出力されるまでテストする
Go言語の環境構築はこちら

実行環境テスト

# テスト用ディレクトリを作成
$ mkdir -p ~/go/src/test

# ディレクトリへ移動
$ cd ~/go/src/test

# テスト用のファイルを作成
$ touch test.go

# テスト用のファイルを編集
$ vi test.go

//test.go

package main

import "fmt"

func main() {
    fmt.Printf("test, go\n")
}
# 作成したディレクトリへ移動
$ cd ~/go/src/hello

# ビルドしてバイナリファイルを生成
$ go build

:wqで保存し、ビルドしてバイナリファイルを生成

実行する

$ ./test
test, go

※エラーが出てしまう場合

$ go env

Go言語関連の環境変数を確認し、PATHあたりを確認してみると良いのかな?

※出力結果を適応

テストで出力した内容を変更した場合は上書きが必要なので、再度ビルドする

$ go build

テストまでクリアしたので、これからGoの勉強を開始します!!

2
0
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
2
0