name: golang-dev description: When you are developing Go code in an environment where the final deployment runs in Docker, but Go is installed locally on Ubuntu for rapid development iteration.
Go Development Workflow
Critical Development Process
Always compile and test Go code locally BEFORE rebuilding any Docker image or container.
Why Local-First Development
Speed: Local
go buildandgo testcomplete in seconds. Docker image rebuilds take significantly longer due to layer caching, dependency resolution, and container startup overhead.Faster Feedback Loop: Catching syntax errors, type mismatches, and failing tests locally saves minutes per iteration compared to discovering them after a Docker build.
Resource Efficiency: Avoid creating unnecessary intermediate Docker images and consuming disk space for builds that will fail.
Debugging: Local tooling (
go vet,staticcheck,dlvdebugger) provides richer diagnostics than container logs.
Required Local Steps Before Docker
Format the code:
go fmt ./...Vet for common issues:
go vet ./...Compile successfully:
go build ./...Run tests:
go test ./...Only after all pass: Proceed with
docker buildordocker compose up --build
Exception Cases
Only skip local testing if:
- The change is Docker-specific (Dockerfile, entrypoint scripts, environment variables)
- You're debugging container networking or volume mounting issues
- The test requires services only available in the Docker Compose stack (and mocking isn't feasible)
Even in these cases, still run go build locally to catch compilation errors.