1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

anyenvでgoの開発環境を構築

Last updated at Posted at 2021-02-14

goenvのインストール

$ anyenv install goenv

/var/folders/hk/_11v61jd5kn65bw_v55f9fjr0000gn/T/goenv.20210214134326.1521 ~
Cloning https://github.com/syndbg/goenv.git master to goenv...
Cloning into 'goenv'...
remote: Enumerating objects: 69, done.
remote: Counting objects: 100% (69/69), done.
remote: Compressing objects: 100% (58/58), done.
remote: Total 14402 (delta 15), reused 22 (delta 8), pack-reused 14333
Receiving objects: 100% (14402/14402), 2.61 MiB | 685.00 KiB/s, done.
Resolving deltas: 100% (9760/9760), done.
~

Install goenv succeeded!
Please reload your profile (exec $SHELL -l) or open a new session.

go(v1.15.7)のインストール

$ goenv install 1.15.7
$ goenv global 1.15.7        
  • バージョンの確認を行う
$ go version
go version go1.15.7 darwin/amd64

サンプルファイルの実行

  • 適当なディレクトリ配下にmain.goファイルを作成
main.go
package main

import "fmt"

func main()  {
    fmt.Println("Hello,World!")
}
  • ターミナルからgo run main.goを実行して**Hello,World!**が出力されれば無事にgoの開発環境構築は完了。
$ go run main.go
Hello,World!
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?