This tutorial will show you how to install, build, and run Go on Chrome OS. Please note this has only been tested on a 64GB LTE Pixel, however it should work on other Chromebooks. Note that enabling developer mode reduces the security guarantees offered by Chrome OS.
First download the latest version of Go for Linux from the Go Downloads page. After that, open a shell by hitting (CTRL+ALT+T) and typing in shell
then hit enter. Then extract it using the following command (when replacing < Go Linux package >
with the name of the file you downloaded):
sudo tar xpvf ~/Downloads/< Go Linux package > -C /usr/local
Go should now be installed you can test this by typing /usr/local/go/bin/go
. If it installed correctly, you should see the Go help prompt. Go is now installed.
To keep this simple just create a folder called /usr/local/go/work
. Also, create a folder called src
inside /usr/local/go
.
Add the following to ~/.bashrc
:
export GOPATH="/usr/local/go/work" export PATH="${PATH}:/usr/local/go/bin:${GOPATH}/bin"
This will allow you to run your Go programs in your shell.
First create a folder inside of your /usr/local/go/src
folder. After that create a file in your folder called hello.go
with the following in it:
package main
import "fmt"
func main() {
fmt.Printf("Hello, Chrome OS!\n")
}
Now, run go install hello
. Then, run ${GOPATH}/bin/hello
and you should see Hello, Chrome OS!
.
Please go to Issues to report any issues you have.