Index: src/cmd/go/main.go |
=================================================================== |
--- a/src/cmd/go/main.go |
+++ b/src/cmd/go/main.go |
@@ -36,6 +36,10 @@ |
// Flag is a set of flags specific to this command. |
Flag flag.FlagSet |
+ |
+ // CustomFlags indicates that the command will do its own |
+ // flag parsing. |
+ CustomFlags bool |
} |
// Name returns the command's name: the first word in the usage line. |
@@ -96,8 +100,12 @@ |
for _, cmd := range commands { |
if cmd.Name() == args[0] && cmd.Run != nil { |
cmd.Flag.Usage = func() { cmd.Usage() } |
- cmd.Flag.Parse(args[1:]) |
- args = cmd.Flag.Args() |
+ if cmd.CustomFlags { |
+ args = args[1:] |
+ } else { |
+ cmd.Flag.Parse(args[1:]) |
+ args = cmd.Flag.Args() |
+ } |
cmd.Run(cmd, args) |
exit() |
return |
@@ -209,6 +217,8 @@ |
exitStatus = 1 |
} |
+var logf = log.Printf |
+ |
func exitIfErrors() { |
if exitStatus != 0 { |
exit() |