| // Copyright 2014 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. |
| test(" ") // old deprecated syntax |
| cmd := exec.Command("go", "run", "-ldflags=-X main.tbd"+sep+"hello -X main.overwrite"+sep+"trumped -X main.nosuchsymbol"+sep+"neverseen", "linkx.go") |
| var out, errbuf bytes.Buffer |
| fmt.Println(errbuf.String()) |
| fmt.Println(out.String()) |
| want := "hello\ntrumped\n" |
| fmt.Printf("got %q want %q\n", got, want) |
| cmd = exec.Command("go", "run", "-ldflags=-X main.tbd", "linkx.go") |
| _, err = cmd.CombinedOutput() |
| fmt.Println("-X linker flag should not accept keys without values") |