Leave a Comment
Install go2 beta on MacOS
A quick guide on installing golang v2 development revision.
It works for my MacOS Big Sur (with an Intel processor).
1 2 3 4 5 6 7 8 |
cd ~/Downloads git clone https://go.googlesource.com/go goroot cd ./goroot git checkout dev.go2go cd ./src CGO_ENABLED=0 ./all.bash # optional, if you see "xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun" xcode-select --install |
Save somewhere the values of the following environment variables:
1 2 |
echo $PATH echo $GOROOT |
Then change your environment variables like that:
1 2 |
export PATH=$HOME/Downloads/goroot/bin:$PATH export GOROOT=$HOME/Downloads/goroot |
Then create a file somewhere and name it main.go2
1 2 3 4 5 6 7 |
package main import "fmt" func main() { fmt.Printf("hello, world\n") } |
You should be able to run it with
1 |
go tool go2go run ./main.go2 |
To revert back to your regular golang v1, change the vars back to:
1 2 |
export PATH=$HOME/bin:/usr/local/bin:~/go/bin:$PATH (as it was for me before) export GOROOT=$HOME/.gvm/gos/go1.15.5 (as it was for me before) |
Useful links:
- https://go.googlesource.com/go/+/refs/heads/dev.go2go/README.go2go.md
- https://golang.org/doc/install/source
- https://ma.ttias.be/mac-os-xcrun-error-invalid-active-developer-path-missing-xcrun/
- https://www.jetbrains.com/help/go/how-to-use-type-parameters-for-generic-programming.html
Similar Posts
- None Found
LEAVE A COMMENT
Для отправки комментария вам необходимо авторизоваться.