mirror of https://github.com/golang/go.git
cmd/link: remove alternate -X flag spelling
The Go 1.6 release notes say we'll remove the “-X name value” form (in favor of the “-X name=value” form) in Go 1.7. Do that. Also establish the doc/go1.7.txt file. Change-Id: Ie4565a6bc5dbcf155181754d8d92bfbb23c75338 Reviewed-on: https://go-review.googlesource.com/19614 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
0b4f578266
commit
51b624e6a2
|
|
@ -0,0 +1,13 @@
|
|||
Tools:
|
||||
|
||||
cmd/link: "-X name value" form gone (CL XXX)
|
||||
|
||||
Ports:
|
||||
|
||||
SOMETHING WILL HAPPEN
|
||||
|
||||
API additions and behavior changes:
|
||||
|
||||
SOMETHING WILL HAPPEN
|
||||
|
||||
|
||||
|
|
@ -1657,8 +1657,8 @@ func TestLdflagsArgumentsWithSpacesIssue3941(t *testing.T) {
|
|||
func main() {
|
||||
println(extern)
|
||||
}`)
|
||||
tg.run("run", "-ldflags", `-X main.extern "hello world"`, tg.path("main.go"))
|
||||
tg.grepStderr("^hello world", `ldflags -X main.extern 'hello world' failed`)
|
||||
tg.run("run", "-ldflags", `-X "main.extern=hello world"`, tg.path("main.go"))
|
||||
tg.grepStderr("^hello world", `ldflags -X "main.extern=hello world"' failed`)
|
||||
}
|
||||
|
||||
func TestGoTestCpuprofileLeavesBinaryBehind(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -119,33 +119,6 @@ func Ldmain() {
|
|||
obj.Flagstr("memprofile", "write memory profile to `file`", &memprofile)
|
||||
obj.Flagint64("memprofilerate", "set runtime.MemProfileRate to `rate`", &memprofilerate)
|
||||
|
||||
// Clumsy hack to preserve old two-argument -X name val syntax for old scripts.
|
||||
// Rewrite that syntax into new syntax -X name=val.
|
||||
// TODO(rsc): Delete this hack in Go 1.6 or later.
|
||||
var args []string
|
||||
for i := 0; i < len(os.Args); i++ {
|
||||
arg := os.Args[i]
|
||||
if (arg == "-X" || arg == "--X") && i+2 < len(os.Args) && !strings.Contains(os.Args[i+1], "=") {
|
||||
fmt.Fprintf(os.Stderr, "link: warning: option %s %s %s may not work in future releases; use %s %s=%s\n",
|
||||
arg, os.Args[i+1], os.Args[i+2],
|
||||
arg, os.Args[i+1], os.Args[i+2])
|
||||
args = append(args, arg)
|
||||
args = append(args, os.Args[i+1]+"="+os.Args[i+2])
|
||||
i += 2
|
||||
continue
|
||||
}
|
||||
if (strings.HasPrefix(arg, "-X=") || strings.HasPrefix(arg, "--X=")) && i+1 < len(os.Args) && strings.Count(arg, "=") == 1 {
|
||||
fmt.Fprintf(os.Stderr, "link: warning: option %s %s may not work in future releases; use %s=%s\n",
|
||||
arg, os.Args[i+1],
|
||||
arg, os.Args[i+1])
|
||||
args = append(args, arg+"="+os.Args[i+1])
|
||||
i++
|
||||
continue
|
||||
}
|
||||
args = append(args, arg)
|
||||
}
|
||||
os.Args = args
|
||||
|
||||
obj.Flagparse(usage)
|
||||
|
||||
startProfile()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
test(" ") // old deprecated syntax
|
||||
// test(" ") // old deprecated & removed syntax
|
||||
test("=") // new syntax
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue