go-service

🧑‍💻 Development

← Back to README

Style

This repo generally follows the Uber Go Style Guide.

Exported Go identifiers should have GoDoc comments, and each comment should start with the identifier name or Deprecated:.

Development Dependencies

Common repository targets expect these tools on PATH:

Setup (repo)

This repo uses a bin/ git submodule for make targets.

git submodule sync
git submodule update --init

mkcert -install
make create-certs

make dep

If submodule fetch fails, ensure GitHub SSH access is configured (.gitmodules uses git@github.com:... URLs).

Discover targets

make help

Dependencies (vendor/ workflow)

make dep

make dep runs:

Tests are run with -mod vendor, so after dependency changes run make dep before make specs.

Local integration dependencies

make start uses the shared Docker-based environment from the sibling ../docker repo. It requires Docker and may require GitHub SSH access if that sibling repo must be fetched.

Start required services:

make start

Stop them:

make stop

Tests

Run unit tests with race + coverage:

make specs

Artifacts:

Lint and format

make lint
make fix-lint
make format

Security checks

make sec

Benchmarks

make benchmarks
make http-benchmarks
make grpc-benchmarks
make limiter-benchmarks
make sql-benchmarks
make cache-benchmarks
make bytes-benchmarks
make strings-benchmarks
make id-benchmarks
make net-http-benchmarks
make http-content-benchmarks

Fuzz tests

make fuzzes
make bytes-fuzz
make time-fuzz
make encoding-fuzz
make compress-fuzz
make net-fuzz
make package=encoding/json name=FuzzUnmarshal fuzztime=10s fuzz

Coverage reports

make coverage
make html-coverage
make func-coverage

Code generation (Buf)

Root generation targets are for the internal/test protobuf fixtures. After changing those fixtures, regenerate them. To match the CI stale-output check, run make generate-stale from a clean worktree, or after staging the intended fixture and generated-file changes:

make generate
make generate-stale

Architecture diagrams

make diagrams
make crypto-diagram
make database-diagram
make telemetry-diagram
make transport-diagram