- Go: Go 1.26.4 or later (matches the
godirective ingo.mod; required for thetooldirective and modern syntax) - gox: Cross-platform Go compilation tool (required for
make release) - mockgen: Provided as a
go.modtooldependency, so no separate install is needed (see Code Generation)
go install github.com/mitchellh/gox@latestEnsure your Go bin directory is in your PATH:
export PATH=$PATH:$(go env GOPATH)/binAfter cloning the repository:
-
Install dependencies:
go mod download
-
Sync and verify dependencies:
go mod tidy
-
Verify setup by running tests:
make test
Build a binary for your current platform:
make lifecycledThis creates a lifecycled binary in the current directory.
Run tests, formatting, and vet checks:
make testThis will:
- Format code with
gofmt - Run
go vetfor static analysis - Run all tests with race detection
make cleanThe current release process uses gox for cross-platform compilation:
make releaseThis builds binaries for the following platforms:
- freebsd/amd64
- linux/386
- linux/aarch64
- linux/amd64
- linux/arm64
- windows/amd64
Output Location: All binaries are placed in the build/ directory with the naming pattern:
build/lifecycled-{OS}-{Arch}
The build process automatically injects version information from git tags:
VERSION=$(git describe --tags --candidates=1 --dirty 2>/dev/null || echo "dev")This version is embedded into the binary using Go build flags:
-ldflags="-s -w -X main.Version=$(VERSION)"-
Create and push a git tag:
git tag v1.2.3 git push --tags
-
Build release binaries:
make release
-
Create GitHub release:
- Navigate to the GitHub repository
- Create a new release
- Select the tag created in step 1
- Set the Release title to the tag (
v1.2.3) - Set the Previous tag to the tag of the most previous release
- Click Generate Release Notes
-
Upload binaries:
- Manually upload all binaries from the
build/directory to the GitHub release
- Manually upload all binaries from the
-
Publish the release
The project uses code generation to create mock implementations for testing. If you make changes to interfaces or need to regenerate mocks:
make generateThis runs go generate ./..., which invokes go tool mockgen to regenerate the mock files in the mocks/ directory. mockgen is pinned as a tool dependency in go.mod (go.uber.org/mock, the actively maintained fork of github.com/golang/mock), so generation is reproducible without installing mockgen separately.
CI verifies the committed mocks stay in sync by running go generate ./... followed by git diff --exit-code, so regenerate and commit the result after changing any interface. CI also runs golangci-lint (config in .golangci.yml) and go test -race.
Generated files:
mocks/mock_autoscaling_client.gomocks/mock_sns_client.gomocks/mock_sqs_client.go
.
├── cmd/
│ └── lifecycled/ # Main application entry point
├── mocks/ # Generated mock implementations for testing
├── tools/ # Additional tools (e.g., lifecycled-queue-cleaner)
├── terraform/ # Terraform configurations
├── init/ # Initialization scripts
├── build/ # Build output directory (created by make release)
├── .buildkite/ # Buildkite CI configuration
└── .github/ # GitHub workflows and configuration
- The project uses Go modules (
GO111MODULE=on) - After cloning or when dependencies change, run
go mod tidyto sync dependencies - Version information is derived from git tags
- Mock generation uses
go.uber.org/mock(the actively maintained fork of gomock), not the deprecatedgithub.com/golang/mock - Generated mock files should not be manually edited; regenerate them using
make generate - The project requires Go 1.26.4 or later (the
godirective ingo.mod); thetooldirective needs at least Go 1.24