概述
Go语言一直以来都在不断进化,旨在提供更加高效、简洁的编程体验。在Go 1.17版本中,go get命令的一项重要变更引起了开发者的广泛关注。这一变化主要涉及go get在安装可执行文件时的用法,它标志着Go社区对模块系统的进一步优化和规范化。本文将深入探讨这一变更的具体内容、背后的原因以及对Go开发者的具体影响。
go get命令的变更
在Go 1.17及以后的版本中,当开发者尝试使用go get命令来安装可执行文件时,会遇到以下警告信息:
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-