LoginSignup
1
0

More than 3 years have passed since last update.

WindowsでGoの開発環境構築

Posted at

Chocolateyのインストール

PowerShellを管理者権限で起動し、下記のコマンドを実行します。

Get-ExecutionPolicy

このコマンドでもしRestrictedが返ってきたら、Set-ExecutionPolicy AllSignedまたはSet-ExecutionPolicy Bypass -Scope Processを実行するらしいのですが、私の環境では、Bypassが返されたので、未検証です。

続いて、下記を実行します。

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Installation of Chocolatey to default folder requires Administrative permissions. Please run from elevated prompt. Plea
se see https://chocolatey.org/install for details and alternatives if needing to install as a non-administrator.

と言われたらPowerShellを管理者権限で起動してください。

Chocolatey (choco.exe) is now ready.
が表示されればインストールは成功です。

Goのインストール

choco install golang

The install of golang was successful.
が表示されればインストールは成功です。

PATHの編集

環境変数PATHに%GOPATH%\binを追加します。

[コントロールパネル] -> [システムとセキュリティ] -> [システム] -> [システムの詳細設定] -> [環境変数] でPath%GOPATH%\binを追加します。
image.png

インストールの確認

PowerShellを起動し、go versionでバージョン情報が表示されればインストール成功です!

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