- (skip this if you have a working Go installation)
- Install Go
- All Go code resides in a single directory called a workspace. Go expects your workspace to be
$HOME/go
. Create this directory. If you want your go workspace to be located in a different directory, you'll have to set aGOPATH
environment variable.
Since the repository is private, you'll need to change your .gitconfig
to force it to use SSH:
git config --global url."git@github.com:".insteadOf "https://github.com/"
Then
$ go get github.com/aaizuss/go-ttt
It downloads files from this repo to your local directory, $GOPATH/src/github.com/aaizuss/go-ttt
$ cd $GOPATH/src/github.com/aaizuss/go-ttt
$ go run play.go
$ cd $GOPATH/src/github.com/aaizuss/go-ttt
$ go test ./...
will run all the unit tests
Alternatively, you can navigate to each subdirectory and run $ go test
There is a computer vs computer test that takes a little longer to run, so it's in its own file (/game/ai_test.go
). To run that test, add -tags=aitest
to the test command.
I referred to the following resources to write Go like Gophers do:
- Effective Go
- Go Style Guide
- Naming
- Testing