- Build:
go build -o buildkite-agent .orgo run *.go <command> - Test:
go test ./...(run all tests) - Test (single package):
go test ./path/to/package - Test (race detection):
go test -race ./... - Lint/Format:
go tool gofumpt -extra -w .andgolangci-lint run - Generate:
go generate ./... - Deps:
go mod tidy
Go CLI application with main packages:
agent/: Core agent worker, job runner, log streaming, pipeline uploadapi/: HTTP client for Buildkite API communicationcore/: Programmatic job control interfacejobapi/: Local HTTP server for job introspection during executionclicommand/: CLI command implementationsinternal/: Internal utilities (shell, sockets, artifacts, etc.)process/: Process execution, signal handling, output streaminglogger/: Structured loggingenv/: Environment variable management
- Formatting with
gofumptin extra mode:go tool gofumpt -extra -w . - Struct-based configuration patterns (e.g.,
AgentWorkerConfig,JobRunnerConfig) - Context-aware functions:
func Name(ctx context.Context, ...) - Import organization: stdlib, external deps, internal packages
- Error handling: explicit errors, wrapped with context
- Naming: PascalCase for exported, camelCase for private, ALL_CAPS for constants
- Interface types end with -er suffix where appropriate
- Use
github.com/urfave/clifor CLI commands