I used Go installed on Windows so far, but I want to develop with WSL2 anyway, so I will install Go on WSL2
OS is ** Windows 10 Pro 64bit ** (version 2004 OS build 19041.572) ** WSL2 ** and OS ** Ubuntu-20.04 **
First, open Download and install --The Go Programming Language, select "Linux", and download the installer for Linux.
Move the installer downloaded at this time (go1.15.3.linux-amd64.tar.gz
in the example) to a place that is easy for you to understand.
Then open a command prompt or Windows terminal and run the wsl
command to launch WSL
Microsoft Windows [Version 10.0.19041.572]
(c) 2020 Microsoft Corporation. All rights reserved.
C:\Users\sola>wsl
root@sola-pc:/mnt/c/Users/sola#
I don't think there is, but ** If Go is installed in advance, please uninstall it **
First, expand to / usr / local
with the following command
go1.15.3.linux-amd64.tar.gz
in the example) is placed, and then execute it.tar -C /usr/local -xzf go1.15.3.linux-amd64.tar.gz
After finishing, move to the route and launch Explorer there
root@sola-pc:/mnt/c/Users/sola# cd ~
root@sola-pc:~# explorer.exe .
root@sola-pc:~#
ʻExplorer.exe .` will launch the following explorer
(* I think that there are differences in files etc. depending on the environment, so please look at the image that a directory like this is opened to the last)
Open .bashrc
with a text editor, add the following line and save.
.bashrc
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
After that, restart the command prompt or terminal and start WSL again.
After launching with the wsl
command, make sure that it is installed with the go version
.
Microsoft Windows [Version 10.0.19041.572]
(c) 2020 Microsoft Corporation. All rights reserved.
C:\Users\sola>wsl
root@sola-pc:/mnt/c/Users/sola# go version
go version go1.15.3 linux/amd64
root@sola-pc:/mnt/c/Users/sola#
Recommended Posts