From 8ed27e6007765591307a9eb61ad70f6dd25680a9 Mon Sep 17 00:00:00 2001 From: Adam Fisher Date: Tue, 4 Aug 2026 14:21:27 +0000 Subject: [PATCH] Adopt .tool-versions and standardise setup script There was no declared toolchain version and script/setup ran `brew install go`, which fails in CI and off macOS. Adds .tool-versions pinning go 1 and rewrites script/setup to run `go mod download`. This project has no dependencies, so that is currently a no-op, but it matches the other skeletons. script/start gains set -euo pipefail and the cd to project root. Adds a .gitignore for the `go` binary produced by go build. Updates the README to the standard template. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- go/.gitignore | 2 ++ go/.tool-versions | 1 + go/README.md | 27 +++++++++++++++++++++------ go/script/setup | 6 ++++-- go/script/start | 4 +++- 5 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 go/.gitignore create mode 100644 go/.tool-versions 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