Why Go 1.17 Deprecates ‘go get’ for Executables and What to Use Instead
In Go 1.17 the traditional ‘go get’ command for installing executables is deprecated in module mode, prompting developers to switch to ‘go install’ with version tags or use ‘go get -d’ for dependency fetching, a change aimed at clearer dependency and tool management.
Overview
Go has continuously evolved to provide a more efficient and concise programming experience. Starting with Go 1.17, the go get command’s behavior when installing executables in module mode was changed, marking a significant step in the Go community’s effort to refine the module system.
Change to go get
When developers run go get to install an executable in Go 1.17 or later, they see the following warning:
go get: installing executables with 'go get' in module mode is deprecated.
To adjust and download dependencies of the current module, use 'go get -d'.
To install using requirements of the current module, use 'go install'.
To install ignoring the current module, use 'go install' with a version,
like 'go install example.com/cmd@latest'.
For more information, see https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'.This warning indicates that using go get to install executables in module mode is now deprecated. The recommended approaches are:
Use go get -d to adjust and download the current module’s dependencies without installing anything.
Use go install to install the program within the context of the current module.
Use go install together with a version suffix to install a binary while ignoring the current module, e.g., go install example.com/cmd@latest .
Reason Behind the Change
The primary motivation is to clearly separate two distinct operations: fetching dependencies and installing executable tools. In earlier versions, go get performed both tasks, which could cause confusion and accidental version mismatches, especially in projects that enable Go Modules. By splitting the responsibilities, the Go community aims to improve dependency clarity and overall project maintainability.
Impact on Developers
Clear distinction between dependency management and tool installation: Developers should now use go install for installing tools and go get -d solely for downloading dependencies.
More explicit version management: Specifying a version in go install (e.g., go install example.com/[email protected] ) makes it easier to track and avoid version conflicts.
Documentation and CI/CD updates required: Project documentation, CI/CD pipelines, and automation scripts need to be revised to adopt the new command usage.
Conclusion
The modification of go get in Go 1.17 reflects a deliberate move toward more robust module management. While developers must adjust their workflows and update scripts, the change ultimately leads to clearer project structures, better version control, and improved maintainability. For detailed guidance, consult the official Go documentation and adopt the recommended best practices.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Ops Development & AI Practice
DevSecOps engineer sharing experiences and insights on AI, Web3, and Claude code development. Aims to help solve technical challenges, improve development efficiency, and grow through community interaction. Feel free to comment and discuss.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
