• David Crawshaw's avatar
    cmd/go: add source file contents to plugin hash · 4e2ef7f7
    David Crawshaw authored
    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: 's avatarIan Lance Taylor <iant@golang.org>
    4e2ef7f7
main.go 471 Bytes