Build, Test & Lint

The Go extension keeps Go's normal tools but runs them through Putnami jobs.

Build

putnami build .
putnami build . --target linux/amd64

Build behavior:

  • optionally refreshes dependencies unless --skip-deps is set
  • compiles packages and binaries
  • supports cross-compilation through --target
  • writes output to the job output directory or --output

Useful options:

  • --target <os/arch>
  • --output <path>
  • --skip-deps
  • --readonly
  • --mod <readonly|vendor|mod>
  • --ldflags, --gcflags, --asmflags, --tags
  • --race, --trimpath, --buildmode, --cgo

Test

putnami test .
putnami test . --coverage
putnami test . --coverage-threshold 80

Test behavior:

  • runs Go tests with structured JSON output
  • can generate coverage profile and HTML report
  • parses results into Putnami diagnostics and metrics

Useful options:

  • --coverage
  • --race
  • --timeout <duration>
  • --run <pattern>
  • --count <n>
  • --shuffle
  • --bench <pattern>
  • --coverage-threshold <pct>

Lint

putnami lint .
putnami lint . --tool golangci-lint

Lint runs golangci-lint, staticcheck, or both.

Config resolution for golangci-lint:

  1. --config
  2. project .golangci.yml or .golangci.yaml
  3. workspace .golangci.yml or .golangci.yaml
  4. bundled default config from @putnami/go