mirror of
https://github.com/golang/go
synced 2024-11-24 07:40:17 -07:00
4e2ef7f7f9
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>
24 lines
471 B
Go
24 lines
471 B
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
// // No C code required.
|
|
import "C"
|
|
|
|
func FuncInt() int { return 1 }
|
|
|
|
// Add a recursive type to to check that type equality across plugins doesn't
|
|
// crash. See https://golang.org/issues/19258
|
|
func FuncRecursive() X { return X{} }
|
|
|
|
type Y struct {
|
|
X *X
|
|
}
|
|
type X struct {
|
|
Y Y
|
|
}
|
|
|
|
func main() {}
|