diff --git a/go/.gitignore b/go/.gitignore new file mode 100644 index 0000000..7f1aba2 --- /dev/null +++ b/go/.gitignore @@ -0,0 +1,2 @@ +# Go build output +/go diff --git a/go/.tool-versions b/go/.tool-versions new file mode 100644 index 0000000..a2e36c0 --- /dev/null +++ b/go/.tool-versions @@ -0,0 +1 @@ +go 1 diff --git a/go/README.md b/go/README.md index 0898873..b6e56bb 100644 --- a/go/README.md +++ b/go/README.md @@ -1,14 +1,29 @@ -# GO +# Go Skeleton project for Go. +## Prerequisites + +The toolchain this project needs is declared in [`.tool-versions`](./.tool-versions): + +``` +go 1 +``` + +Install those however you prefer, as long as they end up on your `PATH`. The quickest route is +[mise](https://mise.jdx.dev/), which reads the file for you: + +```sh +mise install +``` + ## Usage -- `./script/setup` to install dependencies +- `./script/setup` to fetch dependencies - `./script/test` to run the tests -- `./script/start` to run the code +- `./script/start` to run the app ## Structure -- Code located in [`pairing.go`](./src/pairing.go) and [`main.go`](main.go) -- Tests located in [`pairing_test.go`](./src/pairing_test.go) +- Code located in [`main.go`](./main.go) and [`src/pairing.go`](./src/pairing.go) +- Tests located in [`src/pairing_test.go`](./src/pairing_test.go) -However, you're free to organise your code as you like. +However, you're free to organise your code as you like. diff --git a/go/script/setup b/go/script/setup index d00f272..ea96004 100755 --- a/go/script/setup +++ b/go/script/setup @@ -1,5 +1,7 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -brew install go +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +go mod download diff --git a/go/script/start b/go/script/start index 3d6bd90..d5624cc 100755 --- a/go/script/start +++ b/go/script/start @@ -1,5 +1,7 @@ #!/usr/bin/env bash -set -e +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." go run main.go