]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: remove alternate -X flag spelling
authorRuss Cox <rsc@golang.org>
Fri, 29 Jan 2016 03:50:03 +0000 (22:50 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 19 Feb 2016 01:35:25 +0000 (01:35 +0000)
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>
doc/go1.7.txt [new file with mode: 0644]
src/cmd/go/go_test.go
src/cmd/link/internal/ld/pobj.go
test/linkx_run.go

diff --git a/doc/go1.7.txt b/doc/go1.7.txt
new file mode 100644 (file)
index 0000000..b2573be
--- /dev/null
@@ -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
+
+
index e55fc360de4ce79ff499b4d9241827eb3566fc87..7d3891517648e5f102feae95743c3f9888e44fcf 100644 (file)
@@ -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) {
index 808d377f8a0473ea1744658e9a49027219d30725..9ec14c24ed59161baf44bdd2d831484f99637573 100644 (file)
@@ -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()
index a6c7c67014cd4132e3798f316fbc65f24f73e799..440271ac4a54589cb5a0fa748b42fc31293b5946 100644 (file)
@@ -18,7 +18,7 @@ import (
 )
 
 func main() {
-       test(" ") // old deprecated syntax
+       // test(" ") // old deprecated & removed syntax
        test("=") // new syntax
 }