]> Cypherpunks repositories - gostls13.git/commit
cmd/go: add source file contents to plugin hash
authorDavid Crawshaw <crawshaw@golang.org>
Sat, 2 Sep 2017 14:31:52 +0000 (10:31 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Sat, 9 Sep 2017 15:58:20 +0000 (15:58 +0000)
commit4e2ef7f7f9a3351c3774148c40fe0d7f12403da5
treefc549d88925ce6b9671a61201d83607e101f5dd5
parent3d7042fba341180e63ea27fdfafbbab2499314aa
cmd/go: add source file contents to plugin hash

It is common to have multiple plugins built from ephemeral
source files all with the same name:

# generate main.go
go build -buildmode=plugin -o=p1.so main.go
# rm main.go, generate new main.go
go build -buildmode=plugin -o=p2.so main.go
...

These different plugins currently have the same build ID,
and hence the same package path. This means only one can be
loaded.

To remove this restriction, this commit adds the contents of the
main package source files to the plugin hash.

Fixes #19358

Change-Id: Icd42024b085feb29c09c2771aaecb85f8b528dd3
Reviewed-on: https://go-review.googlesource.com/61170
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
misc/cgo/testplugin/test.bash
misc/cgo/testplugin/unnamed1/main.go [moved from misc/cgo/testplugin/unnamed1.go with 100% similarity]
misc/cgo/testplugin/unnamed2/main.go [moved from misc/cgo/testplugin/unnamed2.go with 100% similarity]
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/work/build.go