1
0
mirror of https://github.com/golang/go synced 2024-11-23 16:50:06 -07:00

cmd/go: don't set LD_LIBRARY_PATH for SWIG

Setting LD_LIBRARY_PATH when running "go test" for a package that uses
SWIG dates back to the initial introduction of SWIG support in
CL 5845071 in 2012. Back then SWIG worked by creating a shared library,
but in CL 6851 in 2015 we changed SWIG to generate cgo input files,
and no shared library was used. Since we no longer use a shared library,
we no longer need to set LD_LIBRARY_PATH.

Change-Id: I31ecc03c6c52f4efdf2ef6fb3ebeab35adc325aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/522035
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2023-08-22 15:08:11 -07:00 committed by Gopher Robot
parent fbbed139a1
commit 789b3f8407

View File

@ -1400,25 +1400,6 @@ func (r *runTestActor) Act(b *work.Builder, ctx context.Context, a *work.Action)
cmd.Stdout = stdout cmd.Stdout = stdout
cmd.Stderr = stdout cmd.Stderr = stdout
// If there are any local SWIG dependencies, we want to load
// the shared library from the build directory.
if a.Package.UsesSwig() {
env := cmd.Env
found := false
prefix := "LD_LIBRARY_PATH="
for i, v := range env {
if strings.HasPrefix(v, prefix) {
env[i] = v + ":."
found = true
break
}
}
if !found {
env = append(env, "LD_LIBRARY_PATH=.")
}
cmd.Env = env
}
cmd.Cancel = func() error { cmd.Cancel = func() error {
if base.SignalTrace == nil { if base.SignalTrace == nil {
err := cmd.Process.Kill() err := cmd.Process.Kill()