Guidance for AI agents working with Go code in the Optimism monorepo. See dev-workflow.md for tool versions, PR workflow, and other cross-language guidance.
Each Go service has its own justfile — run just --list in any service directory to see available targets.
# Build a single service (pattern: just ./<service>/<binary>)
just ./op-node/op-node
# Build all Go components
just build-go# Test a single service
cd <service> && just test
# Test specific packages
go test ./op-node/rollup/derive/...
# Run the full test suite from the repo root
just go-testsEach service justfile has a generate-mocks target:
cd <service> && just generate-mocksThe repo uses a custom golangci-lint build with additional analyzer plugins. The standard golangci-lint binary will not catch all issues — always lint through just.
# Lint (also verifies compilation and module tidiness)
just lint-go
# Lint with auto-fix
just lint-go-fixThe linter configuration is in .golangci.yaml — read it when you need specifics on which linters are enabled and how they're scoped.
Run these checks before committing Go changes. Fix all issues — CI enforces zero warnings.
-
Lint — this also verifies the code compiles and modules are tidy:
just lint-go
-
Test — run tests for changed packages:
cd <service> && just test