A template for Go services with HTTP and gRPC transports.
Create the repository through InfraOps using this template, with its final name and description. Clone it into a directory matching the repository name, then run from the clone’s root:
gh auth login
tools/init
Initialization requires Bash 4+, GNU sed, Git, the GitHub CLI, and the development
tools below. It reads the name, owner, and description from the GitHub repository
at origin, then updates the module path, service names, README, and badges.
An empty description or a checkout directory that differs from the repository
name stops initialization before any files are changed.
The script installs dependencies, regenerates API code, formats the project, and
removes tools/ and this section. It then creates an initialization branch and
runs make ready, which commits, pushes, opens a pull request, and enables
auto-merge.
Use the Go and Ruby toolchain provided by the
CI image. Install Buf for protobuf generation; the
development workflow also uses betteralign, golangci-lint, and RuboCop. See
make help for supported commands and their prerequisites.
Initialize the shared tooling before using Make, then install dependencies and build the server:
git submodule sync && git submodule update --init
make dep
make build
Start the server with the local development configuration:
./go-service-template server -config file:test/.config/server.yaml
The local configuration listens for HTTP on port 11000 and gRPC on port
12000. It exports traces to an OTLP collector at http://localhost:4318.
See the configuration for transport timeouts, rate
limits, logging, and telemetry settings.
The initial gRPC contract defines
example.v1.Service/Hello, with a message field in the request and response.
Implement the service’s domain behavior and document a working request here.
Regenerate Go and Ruby bindings with make proto-generate after changing the
contract.
The server exposes service health, liveness, and readiness over HTTP:
curl --fail http://localhost:11000/go-service-template/healthz
curl --fail http://localhost:11000/go-service-template/livez
curl --fail http://localhost:11000/go-service-template/readyz
The initial checks use a no-op check for liveness and readiness, and an online
check for service health. The gRPC health service checks example.v1.Service.
See the health wiring and
health scenarios when adding dependency checks.
health:
duration: 1s # Interval between checks.
timeout: 1s # Timeout for the online check.
Container builds use the shared Go service Dockerfile. Deployment configuration is managed in InfraOps; link to the service’s configuration there once it is provisioned.