go version go1.8 linux/amd64
例如,
package main
var V int
go build -buildmode=plugin -v test/main.go
lion@Lion-Laptop [ test ] $ go build -buildmode=plugin -v test/main.go
command-line-arguments
lion@Lion-Laptop [ test ] $
lion@Lion-Laptop [ test ] $ go build -buildmode=plugin -v test/main.go
runtime/internal/sys
runtime/internal/atomic
runtime
runtime/cgo
command-line-arguments
lion@Lion-Laptop [ test ] $
与使用-a
建立建筑物相同
这是因为所有软件包都需要通过配置为动态链接的工具链来重建,并且默认情况下go build
不缓存中间软件包的生成。 我相信在cmd / go上的工作将改变这一状况,并且这个问题将消失。
在此之前,您可以在构建用于缓存中间包构建的插件时使用-i
,因此,这仅在第一次时发生:
$ go build -buildmode=plugin -i -v plugin1
runtime/internal/sys
runtime/internal/atomic
runtime
common
internal/cpu
errors
unicode/utf8
sync/atomic
unicode
internal/race
math
sync
syscall
strconv
reflect
runtime/cgo
plugin1
$ go build -buildmode=plugin -i -v plugin1
plugin1
$
最有用的评论
这是因为所有软件包都需要通过配置为动态链接的工具链来重建,并且默认情况下
go build
不缓存中间软件包的生成。 我相信在cmd / go上的工作将改变这一状况,并且这个问题将消失。在此之前,您可以在构建用于缓存中间包构建的插件时使用
-i
,因此,这仅在第一次时发生: