A go.mod file identifies a Go module and anchors the project to a module path. Create it while starting a project with go mod init. section 2.1 section 8.1.2
Use a repository path when the project will be shared:
- Create a directory, enter it, and run go mod init followed by the chosen module name. section 2.1
- Prefer the full repository path as the module name when publishing code. section 8.1.2
- Confirm that initialization produced a new go.mod file before writing the application. section 2.1
> go mod init example.com/your-repository
Run go mod init with a repository-style path to create the module definition. section 2.1


