diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index 66c1bfc41a0..e52de3b6af2 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -3779,8 +3779,13 @@ func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFL // going to compile. goFile = objdir + goFile newGoFile := objdir + "_" + base + "_swig.go" - if err := os.Rename(goFile, newGoFile); err != nil { - return "", "", err + if cfg.BuildX || cfg.BuildN { + b.Showcmd("", "mv %s %s", goFile, newGoFile) + } + if !cfg.BuildN { + if err := os.Rename(goFile, newGoFile); err != nil { + return "", "", err + } } return newGoFile, objdir + gccBase + gccExt, nil }