Skip to content

Build & Run

Build

# Makefile — embeds version, commit, and build date via ldflags
make build

# or directly
go build -o go-crap-tracker .

Version metadata comes from git describe --tags --always --dirty, git rev-parse HEAD, and the current time, injected into internal/version.

Run

There is no single run subcommand — the app has two roles. Start them in two terminals:

# control plane
./go-crap-tracker serve

# worker
./go-crap-tracker worker

Run without building, for quick iteration:

go run . serve
go run . worker

Local helper scripts

run-server.sh and run-worker.sh export a local GCTD_* environment (DSN, NATS URL, crap_bin) and then launch the binary. They're convenience wrappers for your specific cluster — adjust the env vars before using them.

Makefile targets

Target Action
help list targets (default)
build go build with version ldflags
test go test -v -race -coverprofile=coverage.out ./...
test-coverage run test, then go tool cover -html=coverage.out
fmt go fmt ./...
lint golangci-lint run ./...
mod-tidy go mod tidy
clean remove the binary and coverage.out

Docker

docker build -t go-crap-tracker:latest .

The image defaults to serve (ENTRYPOINT go-crap-tracker, CMD serve); override the command to run worker instead.