Code and config

go.mod viewer

Drop a go.mod to see the module it defines, the Go version it needs, what it requires and what it replaces. Your browser opens it on your device: nothing is uploaded.

Opened on this device, never uploadedDrop or paste another file at any time

What you see

go.mod in the viewerWhat it does
Directives readmodule, go, toolchain, require, replace, exclude, retract, tool, godebug and ignore
RequirementsDirect and indirect apart; commits, pre-releases and +incompatible versions tagged
ReplacementsSaid in words, and a replace that points to a folder named as one
LinksEach module to its page on pkg.go.dev, opened only when you click
ProblemsLines that are not go.mod directives, with their line
NameKnown as go.mod, or by its lines when renamed
Extensions.gomod, .mod
UploadNone: opened on your device

What is a go.mod file?

In short

go.mod sits at the root of a Go module. It names the module, the Go version it needs and every module it requires, each at an exact version. The go command writes most of it: go mod init starts it, and go get and go mod tidy keep it up to date.

How to open a go.mod file

  1. Add your go.mod. Drop the file in the box, choose it or paste it.
  2. Look at it. The module, its Go version and toolchain at a glance, its requirements as a list (direct and // indirect apart, versions that are a commit rather than a release tagged), replace, exclude, retract and tool lines in words, and the file colored with line numbers. Each module links to its page on pkg.go.dev.

Questions

What does // indirect mean in go.mod?

No package in this module imports that module itself; it is required because another requirement needs it. go mod tidy adds and removes the comment.

What is a version like v0.0.0-20250612093000-1a2b3c4d5e6f?

A pseudo-version: a commit that has no release tag, written as the commit’s time in UTC and the first 12 characters of its hash. The viewer tags it as a commit.

Why does Go download another version of itself?

Since Go 1.21, when the go or toolchain line asks for a newer Go than the one installed, the go command fetches that release and uses it, unless the GOTOOLCHAIN setting says not to.

Why does the build fail on another computer?

A replace that points to a folder, such as ../payments, only works where that folder exists. Remove it before you share the module, or use a go.work file for work on several modules at once.

What is the difference between go.mod and go.sum?

go.mod says which modules and versions are used. go.sum holds a checksum of each one, so the go command can tell if a download changed.

Is my file uploaded?

No. The viewer runs in your browser and opens the file on your device. Nothing is sent anywhere.

Can opening a file here damage it?

No. The viewer only reads the file: a browser gives a page no way to change it. If something goes wrong, the view stops and the file is as it was.

Related