0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【備忘録】WSL2 Goインストール

0
Last updated at Posted at 2026-04-29

備忘録 WSL2環境へのGoインストール手順

WSL2環境へGoをインストールするときの手順を忘れないために備忘録として投稿

All releases

Go公式サイトへアクセスし Linux のファイルをダウンロード  

インストールファイルの展開

過去にgoをインストールしたことがある場合は古いバージョンを削除するために下記コマンドを実行

sudo rm -rf /usr/local/go

対象端末に初めてGoをインストールする場合は下記順番でインストール

cp <インストールしたgoファイル> /usr/local
sudo tar -C /usr/local -xzf <インストールしたgoファイル>

# 環境変数に/usr/local/go/binパスを追加
export PATH=$PATH:/usr/local/go/bin
# go versionコマンドを実行しバージョンが出力されたらインストール完了
go version

Hello Worldの出力

mkdir hello
cd hello
go mod init hello
touch hello.go
package main

import "fmt"

func main() {
  fmt.Pringln("Hello World!)
}
go run hello.go

>>>> Hello World!
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?