]> Cypherpunks repositories - gostls13.git/commitdiff
flag: simplify switch-case in isZeroValue
authorGabriel Aszalos <gabriel.aszalos@gmail.com>
Tue, 17 Oct 2017 17:57:01 +0000 (19:57 +0200)
committerIan Lance Taylor <iant@golang.org>
Tue, 17 Oct 2017 20:23:14 +0000 (20:23 +0000)
Simplifies the switch statement in the isZeroValue function by merging
the case branches.

Change-Id: I5b27939b62808dadac0cef632567b17e0e2b9a1d
Reviewed-on: https://go-review.googlesource.com/71390
Run-TryBot: Gabriel Aszalos <gabriel.aszalos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/flag/flag.go

index 5544a25282216b2edd269a6eb7eb1ea203c5acb9..fde7411f82ce1e418423964e42d7b75b60850e02 100644 (file)
@@ -400,11 +400,7 @@ func isZeroValue(flag *Flag, value string) bool {
        }
 
        switch value {
-       case "false":
-               return true
-       case "":
-               return true
-       case "0":
+       case "false", "", "0":
                return true
        }
        return false