diff --git a/src/cmd/go/internal/work/gc.go b/src/cmd/go/internal/work/gc.go index ec01798e091..c144413f85f 100644 --- a/src/cmd/go/internal/work/gc.go +++ b/src/cmd/go/internal/work/gc.go @@ -684,7 +684,7 @@ func (gcToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string) // On Windows, DLL file name is recorded in PE file // export section, so do like on OS X. dir := "." - if (cfg.Goos == "darwin" || cfg.Goos == "windows") && cfg.BuildBuildmode == "c-shared" { + if (cfg.Goos == "darwin" || cfg.Goos == "windows") && (cfg.BuildBuildmode == "c-shared" || cfg.BuildBuildmode == "plugin") { dir, out = filepath.Split(out) } diff --git a/src/cmd/go/testdata/script/build_plugin_reproducible.txt b/src/cmd/go/testdata/script/build_plugin_reproducible.txt new file mode 100644 index 00000000000..b19f0eaa0dc --- /dev/null +++ b/src/cmd/go/testdata/script/build_plugin_reproducible.txt @@ -0,0 +1,11 @@ +[!buildmode:plugin] skip +[short] skip + +go build -trimpath -buildvcs=false -buildmode=plugin -o a.so main.go +go build -trimpath -buildvcs=false -buildmode=plugin -o b.so main.go +cmp a.so b.so + +-- main.go -- +package main + +func main() {} \ No newline at end of file