• Go Modules
  • Recent Changes
  • Go 1.16
  • Go 1.15
  • Go 1.14
  • Go 1.13
  • Table of Contents
  • Quick Start
  • Example
  • Daily Workflow
  • New Concepts
  • Modules
  • go.mod
  • Version Selection
  • Semantic Import Versioning
  • How to Use Modules
  • How to Install and Activate Module Support
  • How to Define a Module
  • How to Upgrade and Downgrade Dependencies
  • How to Prepare for a Release
  • Releasing Modules (All Versions)
  • Releasing Modules (v2 or Higher)
  • Publishing a release
  • Migrating to Modules
  • Automatic Migration from Prior Dependency Managers
  • Providing Dependency Information to Older Versions of Go and Non-Module Consumers
  • Updating Pre-Existing Install Instructions
  • Avoid Breaking Existing Import Paths
  • Incrementing the Major Version When First Adopting Modules with v2+ Packages
  • v2+ Modules Allow Multiple Major Versions Within a Single Build
  • Modules Consuming Non-Module Code
  • Non-Module Code Consuming Modules
  • Strategies for Authors of Pre-Existing v2+ Packages
  • Additional Resources
  • Documentation and Proposal
  • Introductory Material
  • Additional Material
  • Changes Since the Initial Vgo Proposal
  • GitHub Issues
  • FAQs
  • How are versions marked as incompatible?
  • When do I get old behavior vs. new module-based behavior?
  • Why does installing a tool via go get fail with error cannot find main module?
  • How can I track tool dependencies for a module?
  • What is the status of module support in IDEs, editors and standard tools like goimports, gorename, etc?
  • FAQs — Additional Control
  • What community tooling exists for working with modules?
  • When should I use the replace directive?
  • Can I work entirely outside of VCS on my local filesystem?
  • How do I use vendoring with modules? Is vendoring going away?
  • Are there "always on" module repositories and enterprise proxies?
  • Can I control when go.mod gets updated and when the go tools use the network to satisfy dependencies?
  • How do I use modules with CI systems such as Travis or CircleCI?
  • How do I download modules needed to build specific packages or tests?
  • FAQs — go.mod and go.sum
  • Why does 'go mod tidy' record indirect and test dependencies in my 'go.mod'?
  • Is 'go.sum' a lock file? Why does 'go.sum' include information for module versions I am no longer using?
  • Should I commit my 'go.sum' file as well as my 'go.mod' file?
  • Should I still add a 'go.mod' file if I do not have any dependencies?
  • FAQs — Semantic Import Versioning
  • Why must major version numbers appear in import paths?
  • Why are major versions v0, v1 omitted from import paths?"
  • What are some implications of tagging my project with major version v0, v1, or making breaking changes with v2+?
  • Can a module consume a package that has not opted in to modules?
  • Can a module consume a v2+ package that has not opted into modules? What does '+incompatible' mean?
  • How are v2+ modules treated in a build if modules support is not enabled? How does "minimal module compatibility" work in 1.9.7+, 1.10.3+, and 1.11?
  • What happens if I create a go.mod but do not apply semver tags to my repository?
  • Can a module depend on a different version of itself?
  • FAQS — Multi-Module Repositories
  • What are multi-module repositories?
  • Should I have multiple modules in a single repository?
  • Is it possible to add a module to a multi-module repository?
  • Is it possible to remove a module from a multi-module repository?
  • Can a module depend on an internal/ in another?
  • Can an additional go.mod exclude unnecessary content? Do modules have the equivalent of a .gitignore file?
  • FAQs — Minimal Version Selection
  • Won't minimal version selection keep developers from getting important updates?
  • FAQs — Possible Problems
  • What are some general things I can spot check if I am seeing a problem?
  • What can I check if I am not seeing the expected version of a dependency?
  • Why am I getting an error 'cannot find module providing package foo'?
  • Why does 'go mod init' give the error 'cannot determine module path for source directory'?
  • I have a problem with a complex dependency that has not opted in to modules. Can I use information from its current dependency manager?
  • How can I resolve "parsing go.mod: unexpected module path" and "error loading module requirements" errors caused by a mismatch between import paths vs. declared module identity?
  • Why does this error occur?
  • Example problem scenario
  • Resolving
  • Why does 'go build' require gcc, and why are prebuilt packages such as net/http not used?
  • Do modules work with relative imports like import "./subdir"?
  • Some needed files may not be present in populated vendor directory