README
ΒΆ
A unified CLI for Go and microservice development.
It standardizes code quality, SAST security analysis, known-vulnerability (CVE) checks, tests with race detection and coverage, code and mock generation, distroless Docker images, local infrastructure with Docker Compose and full E2E orchestration with Robot Framework.
π― Why godev?
When you have several Go microservices, copying and maintaining identical Makefiles or bash scripts leads to:
- Massive duplication: Bumping a linter version or a security rule means editing 10 repositories.
- Inconsistencies between developers: Commands that work on Linux or CI but fail on macOS because of differences in
lsof,killor Python paths. - Lack of standards: Every microservice ends up with different flags and commands.
godev centralizes everything in a single native Go binary. Your microservices no longer need a Makefile, a Dockerfile or a docker-compose.yaml of their own.
π How It Works
flowchart TD
Dev["Developer / CI Workflow"] --> CLI["godev CLI"]
subgraph Quality["1. Quality, Linters & Security"]
CLI --> CMD_VERIFY["godev verify (Full Pipeline)"]
CLI --> CMD_LINT["godev lint (golangci-lint)"]
CLI --> CMD_SEC["godev sec (gosec SAST)"]
CLI --> CMD_VULN["godev vulncheck (govulncheck CVEs)"]
CLI --> CMD_TEST["godev test (gotestsum, race, coverage)"]
end
subgraph CodeGen["2. Code & Mock Generation"]
CLI --> CMD_GEN["godev generate (go generate + mockgen)"]
end
subgraph DockerBuild["3. Container Packaging"]
CLI --> CMD_DOCKER["godev dockerfile / build-image"]
CMD_DOCKER --> DISTROLESS["Universal Multi-Stage Distroless Image"]
end
subgraph LocalStack["4. Local Infrastructure & E2E Testing"]
CLI --> CMD_INFRA["godev infra (Docker Compose: DB, cache, queues)"]
CLI --> CMD_RUN["godev run (Service + local infra)"]
CLI --> CMD_E2E["godev e2e (Robot Framework orchestration)"]
end
Quality --> Out1["Unified Standards & Security Gates"]
DockerBuild --> Out2["Zero-Config Production Artifacts"]
LocalStack --> Out3["Reproducible Local & E2E Testing"]
π Installation
With go install (Recommended)
go install github.com/jmoyonero/godev@latest
Make sure $GOPATH/bin is on your PATH:
export PATH="$HOME/go/bin:$PATH"
Prebuilt binaries
Every tagged release publishes binaries for Linux, macOS and Windows (amd64 and arm64) on the Releases page, together with a checksums.txt. Download the archive for your platform, extract it and move godev somewhere on your PATH.
Check the installed version with:
godev version
Releasing (maintainers)
Releases are built by GoReleaser from .goreleaser.yaml, which injects the version, commit and build date into the binary. Pushing a v* tag triggers the Release workflow:
git tag v0.7.0 && git push origin v0.7.0
To test the release locally without publishing: go run github.com/goreleaser/goreleaser/v2@latest release --snapshot --clean.
Requirements
- Go 1.27+.
golangci-lint(at thelint.versionversion),gosecandgovulncheckrun throughgo run, with no manual install.godev generateuses themockgenfromgo.uber.org/mockdeclared in the microservice'sgo.mod. - Docker with Compose v2, for
infra,run,e2eandbuild-image. Building a project with private modules also needs BuildKit (the default since Docker 23) for the deploy key's secret mount. - Python 3, only for
e2e(godevcreates the virtualenv). - Optional:
gotestsumfor more readable test output (go install gotest.tools/gotestsum@latest).
π Available Commands
1. Quality, Linters and Security
| Command | Description |
|---|---|
godev verify [--skip-sec] [--skip-vuln] |
Full pipeline: runs lint + sec + vulncheck + test in sequence and prints a consolidated report with timings. |
godev lint [--fix] |
Runs golangci-lint at the version pinned in lint.version (the v2 line by default). Supports --fix for automatic fixes. |
godev sec |
SAST security analysis with gosec, excluding the directories in sec.exclude_dirs (generated code and mocks by default). |
godev vulncheck |
Scans dependencies for known vulnerabilities (CVEs) with govulncheck. |
godev test |
Runs the unit tests with -race and -shuffle=on. Uses gotestsum when installed and can produce a coverage report. |
godev test options:
godev test --path ./internal/... # Packages to test (./... by default)
godev test --exclude-dir internal/it # Excludes directories or packages (repeatable)
godev test --race=false --shuffle=off # Disables the race detector or the random order
godev test --format testdox # gotestsum format (testname, pkgname, dots, testdox...)
godev test --plain # Uses 'go test -v' even when gotestsum is installed
godev test --cover # Writes coverage.out and prints the total at the end
godev test --cover-profile cov.out # Coverage profile file
godev test --html # Opens the HTML coverage report (implies --cover)
2. Code and Mock Generation
| Command | Description |
|---|---|
godev generate(aliases: gen, mocks) |
Runs go generate ./... (e.g. OpenAPI with ogen) and uses mockgen to generate mocks for every interface in the module under internal/mocks. |
godev generate --mocks-only # Mocks only, no 'go generate'
godev generate --skip-mocks # 'go generate' only, no mocks
3. Docker Images
godev generates a multi-stage universal Dockerfile: it detects every binary under cmd/ and creates one target per binary. Binaries are built statically and run on gcr.io/distroless/static-debian12:nonroot (no shell, non-root user).
| Command | Description |
|---|---|
godev dockerfile [-w] |
Prints the universal Dockerfile, or writes it to ./Dockerfile with -w. |
godev build-image(alias: docker-build) |
Builds the image locally with the embedded Dockerfile, without needing it in the repo. |
godev build-image -t scheduler # Target to build (api by default)
godev build-image -t api -i my-api:1.2.0 # Image tag (<target>:latest by default)
godev build-image --ssh-key ~/.ssh/deploy_key # Key for private Go modules
godev build-image --no-cache # Builds without cache
Private modules. The generated Dockerfile only configures GOPRIVATE and SSH when the project has private modules. Their host/owner prefix is taken from docker.private_modules in .godev.yaml, or, when it is not set, from the module path in go.mod (module github.com/acme/orders β github.com/acme).
The key that downloads them is always pointed at explicitly, in this order: --ssh-key, docker.ssh_key in .godev.yaml, SSH_DEPLOY_KEY_B64 (base64) or SSH_DEPLOY_KEY (raw). godev never picks one up from ~/.ssh on its own, so a build cannot silently ship your personal key. It is handed to Docker as a BuildKit secret mounted only on the go mod download layer: it never appears in the image, in the build metadata or in the machine's process list.
4. Local Infrastructure (Docker Compose)
If the repo has no docker-compose.yaml, godev generates one on the fly with the services in infra.services:
| Service | Image | Default port |
|---|---|---|
db |
PostgreSQL 18 | 5432 |
wiremock |
WireMock 3 (mappings from infra.wiremock_dir) |
8090 |
jaeger |
Jaeger all-in-one | 16686 (UI) |
otel-collector |
OpenTelemetry Collector | 4317 (OTLP gRPC) |
prometheus |
Prometheus (enables otel-collector) |
9090 |
grafana |
Grafana with preloaded dashboards (enables prometheus) |
3000 |
db, wiremock and jaeger are started by default. If the repo already has a compose file (compose_file, test/infra/, infra/, deployments/ or the root), that one is used.
One infrastructure at a time. Every repo runs its infra under the same Compose project (
godev). Bringing up one repo's infra destroys the previous one (whichever project it belonged to), volumes included, so there are never two stacks fighting over the same ports. The data is disposable: every run starts with a clean database.
| Command | Description |
|---|---|
godev infra up [services...] |
Destroys the previous infra, brings up this repo's in the background and waits until the services are ready (pg_isready, HTTP healthchecks). |
godev infra down [-v] |
Stops the containers (-v / --volumes also removes the volumes). |
godev infra reset-db |
Brings up the infra and applies the seed data script (seeds.sql). |
godev infra ps |
Shows the status of the containers. |
5. Running Services in Development (godev run)
| Command | Description |
|---|---|
godev run [services...](aliases: start, dev) |
Development runner: 1. Brings up the infrastructure (destroying any other project's). 2. Frees busy ports by stopping the container that publishes them instead of blindly killing processes. 3. Builds the services declared in e2e.services of .godev.yaml (or those passed as arguments, e.g. godev run api) into a private temporary directory.4. Starts them in the declared order with the merged environment variables ( e2e.env + svc.env), waiting for each health_url before starting the next.5. Streams each service's logs with colored, aligned prefixes. 6. Stops the processes cleanly on Ctrl+C, and exits with an error if a service crashes. |
Options:
godev run # Builds and starts every service
godev run api # Starts only the 'api' service
godev run --reset-db # Applies seeds.sql to the database before starting (-r)
6. End-to-End with Robot Framework
| Command | Description |
|---|---|
godev e2e (or godev robot) |
Smart E2E orchestrator: 1. Destroys the previous local infrastructure (whichever project it belonged to) and brings up this one's. 2. Restores the database with seeds if the repo defines them. 3. Creates and sets up the Python virtualenv ( .venv) and installs requirements.txt if it does not exist.4. Frees ports in use. 5. Builds and starts the required services in the background with their environment variables. 6. Waits with active healthcheck polling. 7. Runs Robot Framework. 8. Automatically opens the HTML report in the browser (Google Chrome when it is installed on macOS, the default browser elsewhere). 9. Destroys containers, processes and binaries at the end, whether the tests pass or fail, or on Ctrl+C (except the containers with --keep-infra). |
Additional options:
godev e2e --no-browser # Does not open the report in the browser
godev e2e --keep-infra # Does not destroy the infrastructure at the end (to repeat runs)
godev e2e --suite path/ # Runs a specific suite
7. Configuration and Utilities
| Command | Description |
|---|---|
godev init [name] |
Generates a .godev.yaml configuration template in the current directory with the defaults of every section it needs. The optional docker section is not written out: add it by hand when the project has private modules. |
godev version |
Shows the installed version of godev. |
βοΈ Configuration (.godev.yaml)
godev works with no prior configuration, applying sensible Go defaults. If a microservice needs to customize paths, ports or background services, it only needs a .godev.yaml (or .godev.yml) file. Every field is optional:
name: orders-api
infra:
# compose_file: deployments/docker-compose.yaml # Without it, one is generated on the fly
services: [db, wiremock, jaeger] # Add prometheus/grafana for observability
seeds_file: test/seeds.sql
wiremock_dir: test/wiremock
db_service: db
db_user: postgres
db_password: postgres
db_name: orders_api_db # Defaults to <name>_db, or app_db without a name
db_port: 5432
wiremock_port: 8090
prometheus_port: 9090
grafana_port: 3000
otel_port: 4317
docker:
# host/owner prefix of the private Go modules the image needs. Without it,
# the owner of the module in go.mod is used, and a project whose modules are
# all public gets a Dockerfile with no GOPRIVATE or SSH handling.
private_modules: github.com/acme
ssh_key: ~/.ssh/orders_deploy_key # Key for those modules, when --ssh-key is not given
lint:
version: "v2.13.2"
sec:
exclude_dirs:
- "internal/oas"
- "internal/mocks"
test:
path: "./internal/..."
exclude_dirs: []
race: true
shuffle: "on"
format: testname # gotestsum format
cover: false # true = --cover by default
cover_profile: coverage.out
e2e:
enabled: true
type: robot
venv_dir: test/robot/.venv
requirements: test/robot/requirements.txt
suite_dir: test/robot
results_dir: test/robot/results
open_report: true
variables:
API_BASE_URL: "http://127.0.0.1:8888"
SCHEDULER_BASE_URL: "http://127.0.0.1:8080"
env:
DB_HOST: "127.0.0.1"
DB_PORT: "5432"
DB_NAME: "orders_api_db"
DB_USER: "postgres"
DB_PASSWORD: "postgres"
PROVIDER_BASE_URL: "http://127.0.0.1:8090"
services:
- name: api
cmd: ./cmd/api
port: 8888
health_url: "http://127.0.0.1:8888/health"
env:
PORT: "8888"
- name: scheduler
cmd: ./cmd/scheduler
port: 8080
health_url: "http://127.0.0.1:8080/healthz"
env:
PORT: "8080"
The seeds_file and wiremock_dir paths are auto-detected when not set (test/, test/infra/, infra/, deployments/ or the root).
π€ Contributing
Contributions are welcome! Read CONTRIBUTING.md for the development setup, the checks every pull request must pass and the commit conventions. Report security issues privately as described in SECURITY.md. Notable changes are listed in the CHANGELOG.
π¨βπ» Author
Created and maintained by Jonathan Moyonero (@jmoyonero).
π License
Distributed under the MIT License. See LICENSE for more information.
Documentation
ΒΆ
There is no documentation for this package.