Overview
This example shows a minimal envcheck configuration for a Go project. It validates the Go toolchain version and checks for required project files while allowing optional Go environment variables.Configuration
.envcheck.yaml
What This Checks
Tools
- go >=1.18.0: Ensures you have Go 1.18+ with generics support and improved module management
Environment Variables
- GOPATH (optional): Go workspace path - typically not needed with Go modules, but checked if set
- GOBIN (optional): Installation directory for executables - checked if custom location is configured
Files
- go.mod: Go module file - required for dependency management in modern Go projects
- main.go (optional): Entry point for executable - not all Go projects are applications
Expected Output
Tips for Go Projects
Go 1.18 introduced workspaces (
go.work). For multi-module repositories, consider adding go.work as an optional file check.Common Variations
Web API Service
Add service-specific requirements:Microservices Architecture
Validate service dependencies:CLI Tool Development
Check CLI-specific tooling:Library/Package Development
Minimal checks for libraries:Workspace Setup (Go 1.18+)
Multi-module workspace validation:gRPC Service
Validate Protocol Buffers toolchain:Go-Specific Considerations
Go Version Management
Use one of these tools to manage Go versions:- gvm: Go Version Manager
- asdf: Multi-runtime version manager with Go plugin
- goenv: Simple Go version management
Module Initialization
Ifgo.mod is missing, initialize it:
Private Modules
For private repositories, configure GOPRIVATE:Build Tags
For projects using build tags, document required environment:Learn More
- Tools Validator - Go version constraints
- Environment Variables - Go-specific environment setup
- File Validator - Module and workspace structure
- Port Checker - Service port validation
