Install Msys2 Open the MSYS terminal run the updates and then enter these commands.
pacman -Syu
Close and Re-Open Msys2 Terminal
pacman -Su
pacman -Sy base-devel mingw-w64-x86_64-gcc
Add bin folder to MSYS Home
mkdir ~/bin
Put ~/bin
on the path
echo export PATH="\$PATH:~/bin" >> ~/.bashrc
#create envgo command (empty)
touch ~/bin/envgo
chmod u+x ~/bin/envgo
nano ~/bin/envgo
Now you need to open ~/bin/envgo
and past the following (edited suitably).
If you installed go in C:\Go
then the correct path is /c/Go
export GOPATH=/c/GOPATH
export GOROOT=/c/Go
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
Open MSYS2 MinGW 64-bit
terminal:
Type (DOT) envgo
. envgo
Navigate to your module folder or go path:
cd /c/some_go_module
go build