The go.mod Builder creates the manifest that defines a Go module: its import path, the Go language version it targets and a require block of dependencies. Pick the common libraries your service needs and the tool emits valid module paths with real semver tags.
How it works
A go.mod file starts with a module line that sets the canonical import prefix — usually your repository URL — followed by a go directive declaring the minimum language version. The require block lists each dependency as a module path plus a version tag. The tool renders a single inline require for one dependency or a parenthesised block for several, sorting paths so the output is stable.
Go uses semantic import versioning: tags look like v5.1.0, and any major version of 2 or higher carries a /vN suffix in the import path itself, which is why chi appears as github.com/go-chi/chi/v5. Each toggle maps to a real, widely used module at a recent stable tag.
What the generated file contains
A typical output for a web service with a database layer looks like this:
module github.com/your-org/your-app
go 1.23
require (
github.com/go-chi/chi/v5 v5.1.0
github.com/jackc/pgx/v5 v5.6.0
github.com/rs/zerolog v1.33.0
github.com/stretchr/testify v1.9.0
)
Each line names a dependency at a precise tagged release. Go’s module system uses these exact versions; it will not silently upgrade them, which is why pinning to tagged releases is the correct practice rather than using latest.
The dependencies available in this builder
- chi (
github.com/go-chi/chi/v5) — a lightweight, idiomatic HTTP router with middleware support; favoured for microservices because it uses the standardnet/httphandler interface without wrapping it - gin (
github.com/gin-gonic/gin) — a higher-level web framework with built-in binding, validation and rendering; faster to prototype with, heavier than chi - pgx (
github.com/jackc/pgx/v5) — the recommended PostgreSQL driver and connection pool for Go; supports prepared statements, binary protocol and pgxpool for concurrency - sqlx (
github.com/jmoiron/sqlx) — extendsdatabase/sqlwith struct scanning and named queries; pairs with any SQL driver including pgx’s stdlib adapter - zerolog (
github.com/rs/zerolog) — zero-allocation structured JSON logger; outputs fields as a JSON object per line, easily ingested by Datadog, CloudWatch, or similar - testify (
github.com/stretchr/testify) — the de facto assertion library for Go tests; providesassert,require, andmocksub-packages - godotenv (
github.com/joho/godotenv) — loads.envfiles into environment variables for local development - uuid (
github.com/google/uuid) — generates and parses RFC 4122 UUIDs (v4 random is the usual choice for database primary keys)
Next steps
After saving go.mod, let the Go toolchain finish the job:
go mod tidy # add transitive deps, drop unused ones, write go.sum
go build ./...
Tips and notes
Always commit go.sum next to go.mod — it stores verified checksums for every module so builds are tamper-resistant and reproducible. Set the go directive to the version you actually build and test with, since it controls which language features are available. If you later need a dependency this tool does not list, just go get module@version and go mod tidy will fold it in.
If your module is internal and not hosted on a public VCS, you can still use any import path as the module name (for example mycompany.internal/payments). The module directive is just a string identifier; it does not have to be a real URL for private modules.