aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbogem <[email protected]>2016-09-24 23:41:08 +0200
committerbogem <[email protected]>2016-09-25 00:24:05 +0200
commit92abf1943761d39805d58c36456e757becf78b92 (patch)
tree4320ce2c9a98a978416b0d368619244ddaaeec69
parentc7e63cf4530bcd3ba943729cee0efeff2ebea63f (diff)
Optimize fmt statements
-rw-r--r--bool_test.go3
-rw-r--r--count_test.go3
-rw-r--r--flag.go2
3 files changed, 2 insertions, 6 deletions
diff --git a/bool_test.go b/bool_test.go
index 3e38a0f..a4319e7 100644
--- a/bool_test.go
+++ b/bool_test.go
@@ -6,7 +6,6 @@ package pflag
import (
"bytes"
- "fmt"
"strconv"
"testing"
)
@@ -48,7 +47,7 @@ func (v *triStateValue) String() string {
if *v == triStateMaybe {
return strTriStateMaybe
}
- return fmt.Sprintf("%v", bool(*v == triStateTrue))
+ return strconv.FormatBool(*v == triStateTrue)
}
// The type of the flag as required by the pflag.Value interface
diff --git a/count_test.go b/count_test.go
index 716765c..460d96a 100644
--- a/count_test.go
+++ b/count_test.go
@@ -1,13 +1,10 @@
package pflag
import (
- "fmt"
"os"
"testing"
)
-var _ = fmt.Printf
-
func setUpCount(c *int) *FlagSet {
f := NewFlagSet("test", ContinueOnError)
f.CountVarP(c, "verbose", "v", "a counter")
diff --git a/flag.go b/flag.go
index b0b0d46..4258f45 100644
--- a/flag.go
+++ b/flag.go
@@ -416,7 +416,7 @@ func Set(name, value string) error {
// otherwise, the default values of all defined flags in the set.
func (f *FlagSet) PrintDefaults() {
usages := f.FlagUsages()
- fmt.Fprintf(f.out(), "%s", usages)
+ fmt.Fprint(f.out(), usages)
}
// defaultIsZeroValue returns true if the default value for this flag represents