go/go-build-dont-reinstall-stdlibs.patch

36 lines
1.2 KiB
Diff

diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go
index 4bb83f1..16ce829 100644
--- a/src/cmd/go/build.go
+++ b/src/cmd/go/build.go
@@ -91,6 +91,7 @@ func init() {
}
// Flags set by multiple commands.
+var buildS bool // OPENSUSE -s (for packaging only)
var buildA bool // -a flag
var buildN bool // -n flag
var buildP = runtime.NumCPU() // -p flag
@@ -139,6 +140,10 @@ func init() {
// addBuildFlags adds the flags common to the build and install commands.
func addBuildFlags(cmd *Command) {
// NOTE: If you add flags here, also add them to testflag.go.
+
+ // OPENSUSE
+ cmd.Flag.BoolVar(&buildS, "s", false, "")
+
cmd.Flag.BoolVar(&buildA, "a", false, "")
cmd.Flag.BoolVar(&buildN, "n", false, "")
cmd.Flag.IntVar(&buildP, "p", buildP, "")
@@ -762,6 +767,11 @@ func (b *builder) build(a *action) (err error) {
// install is the action for installing a single package or executable.
func (b *builder) install(a *action) (err error) {
+ // OPENSUSE
+ if buildS && (a.p.Standard || a.p.ImportPath == "cmd/cgo") {
+ return nil
+ }
+
defer func() {
if err != nil && err != errPrintedOutput {
err = fmt.Errorf("go install %s: %v", a.p.ImportPath, err)