摘自 :go help buildThe -i flag installs the packages that are dependencies of the target.
The -i flag is deprecated. Compiled packages are cached automatically.
在使用它时,您将收到一条消息:go build: -i 标志已弃用-i 构建标志go build, go install, and go test 接受的 -i 标志现已弃用。-i 标志指示 go 命令安装由命令行上命名的包导入的包。由于构建缓存是在 Go 1.10 中引入的,因此 -i 标志不再对构建时间产生重大影响,并且在安装目录不可写时会导致错误。它来自Go 1.16发行说明因此,它的存在现在并不重要,您可以从参数中删除此标志