-
Notifications
You must be signed in to change notification settings - Fork 107
Building Go
To build and run go in Harvey, follow these steps below. In these steps, we specify the last known good version of go that the team uses. As Harvey uses the Plan 9 build, and Plan 9 does not have first line support in Go, there's always a chance a more recent build won't work. Note that we clone into a folder called golang
because the Harvey project has its own go
git repo, for the code written in go.
Cross Compiling Go
git clone [email protected]:golang/go.git golang
cd golang
git checkout --track origin/release-branch.go1.15
cd src
GOOS=plan9 GOARCH=amd64 ./bootstrap.bash
You now have a folder named ../../go-plan9-amd64-bootstrap
and the bzip tar file ../../go-plan9-amd64-bootstrap.tbz
. The next step is to copy the folder to Harvey (again on the host):
mkdir -p $HARVEY/plan9_amd64/bin
mv ../../go-plan9-amd64-bootstrap $HARVEY/plan9_amd64/bin/go
Building with Go in Harvey Now we're ready to build some go in Harvey. So bring up Harvey and run the commands below.
To set up go (you may want to add this to your profile
).
bind -a /plan9_amd64/bin/go/bin /bin
GOROOT=/plan9_amd64/bin/go
Now to build a simple go program:
- Copy the hello world program here into
hello.go
- Build:
GO111MODULE=off go build hello.go
- Run:
./hello.go
Congratulations - you've built and run your first go program in Harvey.