Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
6140ab26
Commit
6140ab26
authored
Sep 22, 2016
by
wu8685
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update godep for github.com/spf13/pflag
parent
ddc884f8
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
215 additions
and
104 deletions
+215
-104
Godeps.json
Godeps/Godeps.json
+1
-1
hyperkube_test.go
cmd/hyperkube/hyperkube_test.go
+2
-2
hyperkube_test.go
contrib/mesos/cmd/km/hyperkube_test.go
+2
-2
.travis.yml
vendor/github.com/spf13/pflag/.travis.yml
+4
-0
bool.go
vendor/github.com/spf13/pflag/bool.go
+2
-5
count.go
vendor/github.com/spf13/pflag/count.go
+2
-5
flag.go
vendor/github.com/spf13/pflag/flag.go
+38
-25
float32.go
vendor/github.com/spf13/pflag/float32.go
+2
-5
float64.go
vendor/github.com/spf13/pflag/float64.go
+2
-5
int.go
vendor/github.com/spf13/pflag/int.go
+2
-5
int32.go
vendor/github.com/spf13/pflag/int32.go
+2
-5
int64.go
vendor/github.com/spf13/pflag/int64.go
+2
-5
int8.go
vendor/github.com/spf13/pflag/int8.go
+2
-5
string.go
vendor/github.com/spf13/pflag/string.go
+1
-3
string_array.go
vendor/github.com/spf13/pflag/string_array.go
+110
-0
string_slice.go
vendor/github.com/spf13/pflag/string_slice.go
+26
-5
uint.go
vendor/github.com/spf13/pflag/uint.go
+2
-5
uint16.go
vendor/github.com/spf13/pflag/uint16.go
+4
-5
uint32.go
vendor/github.com/spf13/pflag/uint32.go
+5
-6
uint64.go
vendor/github.com/spf13/pflag/uint64.go
+2
-5
uint8.go
vendor/github.com/spf13/pflag/uint8.go
+2
-5
No files found.
Godeps/Godeps.json
View file @
6140ab26
...
...
@@ -2158,7 +2158,7 @@
},
{
"ImportPath"
:
"github.com/spf13/pflag"
,
"Rev"
:
"
1560c1005499d61b80f865c04d39ca7505bf7f0b
"
"Rev"
:
"
c7e63cf4530bcd3ba943729cee0efeff2ebea63f
"
},
{
"ImportPath"
:
"github.com/spf13/viper"
,
...
...
cmd/hyperkube/hyperkube_test.go
View file @
6140ab26
...
...
@@ -177,7 +177,7 @@ func TestServerHelp(t *testing.T) {
x
:=
runFull
(
t
,
"hyperkube test1 --help"
)
assert
.
NoError
(
t
,
x
.
err
)
assert
.
Contains
(
t
,
x
.
output
,
"A simple server named test1"
)
assert
.
Contains
(
t
,
x
.
output
,
"-h, --help
help for hyperkube"
)
assert
.
Contains
(
t
,
x
.
output
,
"-h, --help help for hyperkube"
)
assert
.
NotContains
(
t
,
x
.
output
,
"test1 Run"
)
}
...
...
@@ -185,7 +185,7 @@ func TestServerFlagsBad(t *testing.T) {
x
:=
runFull
(
t
,
"hyperkube test1 --bad-flag"
)
assert
.
EqualError
(
t
,
x
.
err
,
"unknown flag: --bad-flag"
)
assert
.
Contains
(
t
,
x
.
output
,
"A simple server named test1"
)
assert
.
Contains
(
t
,
x
.
output
,
"-h, --help
help for hyperkube"
)
assert
.
Contains
(
t
,
x
.
output
,
"-h, --help help for hyperkube"
)
assert
.
NotContains
(
t
,
x
.
output
,
"test1 Run"
)
}
...
...
contrib/mesos/cmd/km/hyperkube_test.go
View file @
6140ab26
...
...
@@ -125,7 +125,7 @@ func TestServerHelp(t *testing.T) {
x
:=
runFull
(
t
,
"hyperkube test1 --help"
)
assert
.
NoError
(
t
,
x
.
err
)
assert
.
Contains
(
t
,
x
.
output
,
"A simple server named test1"
)
assert
.
Contains
(
t
,
x
.
output
,
"-h, --help
help for hyperkube"
)
assert
.
Contains
(
t
,
x
.
output
,
"-h, --help help for hyperkube"
)
assert
.
NotContains
(
t
,
x
.
output
,
"test1 Run"
)
}
...
...
@@ -133,7 +133,7 @@ func TestServerFlagsBad(t *testing.T) {
x
:=
runFull
(
t
,
"hyperkube test1 --bad-flag"
)
assert
.
EqualError
(
t
,
x
.
err
,
"unknown flag: --bad-flag"
)
assert
.
Contains
(
t
,
x
.
output
,
"A simple server named test1"
)
assert
.
Contains
(
t
,
x
.
output
,
"-h, --help
help for hyperkube"
)
assert
.
Contains
(
t
,
x
.
output
,
"-h, --help help for hyperkube"
)
assert
.
NotContains
(
t
,
x
.
output
,
"test1 Run"
)
}
...
...
vendor/github.com/spf13/pflag/.travis.yml
View file @
6140ab26
...
...
@@ -5,8 +5,12 @@ language: go
go
:
-
1.5.4
-
1.6.3
-
1.7
-
tip
matrix
:
allow_failures
:
-
go
:
tip
install
:
-
go get github.com/golang/lint/golint
-
export PATH=$GOPATH/bin:$PATH
...
...
vendor/github.com/spf13/pflag/bool.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// optional interface to indicate boolean flags that can be
// supplied without "=value" text
...
...
@@ -30,7 +27,7 @@ func (b *boolValue) Type() string {
return
"bool"
}
func
(
b
*
boolValue
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
*
b
)
}
func
(
b
*
boolValue
)
String
()
string
{
return
strconv
.
FormatBool
(
bool
(
*
b
)
)
}
func
(
b
*
boolValue
)
IsBoolFlag
()
bool
{
return
true
}
...
...
vendor/github.com/spf13/pflag/count.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// -- count Value
type
countValue
int
...
...
@@ -28,7 +25,7 @@ func (i *countValue) Type() string {
return
"count"
}
func
(
i
*
countValue
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
*
i
)
}
func
(
i
*
countValue
)
String
()
string
{
return
strconv
.
Itoa
(
int
(
*
i
)
)
}
func
countConv
(
sval
string
)
(
interface
{},
error
)
{
i
,
err
:=
strconv
.
Atoi
(
sval
)
...
...
vendor/github.com/spf13/pflag/flag.go
View file @
6140ab26
...
...
@@ -419,20 +419,36 @@ func (f *FlagSet) PrintDefaults() {
fmt
.
Fprintf
(
f
.
out
(),
"%s"
,
usages
)
}
// isZeroValue guesses whether the string represents the zero
// value for a flag. It is not accurate but in practice works OK.
func
isZeroValue
(
value
string
)
bool
{
switch
value
{
case
"false"
:
return
true
case
"<nil>"
:
return
true
case
""
:
return
true
case
"0"
:
return
true
// defaultIsZeroValue returns true if the default value for this flag represents
// a zero value.
func
(
f
*
Flag
)
defaultIsZeroValue
()
bool
{
switch
f
.
Value
.
(
type
)
{
case
boolFlag
:
return
f
.
DefValue
==
"false"
case
*
durationValue
:
// Beginning in Go 1.7, duration zero values are "0s"
return
f
.
DefValue
==
"0"
||
f
.
DefValue
==
"0s"
case
*
intValue
,
*
int8Value
,
*
int32Value
,
*
int64Value
,
*
uintValue
,
*
uint8Value
,
*
uint16Value
,
*
uint32Value
,
*
uint64Value
,
*
countValue
,
*
float32Value
,
*
float64Value
:
return
f
.
DefValue
==
"0"
case
*
stringValue
:
return
f
.
DefValue
==
""
case
*
ipValue
,
*
ipMaskValue
,
*
ipNetValue
:
return
f
.
DefValue
==
"<nil>"
case
*
intSliceValue
,
*
stringSliceValue
,
*
stringArrayValue
:
return
f
.
DefValue
==
"[]"
default
:
switch
f
.
Value
.
String
()
{
case
"false"
:
return
true
case
"<nil>"
:
return
true
case
""
:
return
true
case
"0"
:
return
true
}
return
false
}
return
false
}
// UnquoteUsage extracts a back-quoted name from the usage
...
...
@@ -455,22 +471,19 @@ func UnquoteUsage(flag *Flag) (name string, usage string) {
break
// Only one back quote; use type name.
}
}
// No explicit name, so use type if we can find one.
name
=
"value"
switch
flag
.
Value
.
(
type
)
{
case
boolFlag
:
name
=
flag
.
Value
.
Type
()
switch
name
{
case
"bool"
:
name
=
""
case
*
durationValue
:
name
=
"duration"
case
*
float64Value
:
case
"float64"
:
name
=
"float"
case
*
intValue
,
*
int64Value
:
case
"int64"
:
name
=
"int"
case
*
stringValue
:
name
=
"string"
case
*
uintValue
,
*
uint64Value
:
case
"uint64"
:
name
=
"uint"
}
return
}
...
...
@@ -519,7 +532,7 @@ func (f *FlagSet) FlagUsages() string {
}
line
+=
usage
if
!
isZeroValue
(
flag
.
DefValue
)
{
if
!
flag
.
defaultIsZeroValue
(
)
{
if
flag
.
Value
.
Type
()
==
"string"
{
line
+=
fmt
.
Sprintf
(
" (default %q)"
,
flag
.
DefValue
)
}
else
{
...
...
vendor/github.com/spf13/pflag/float32.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// -- float32 Value
type
float32Value
float32
...
...
@@ -23,7 +20,7 @@ func (f *float32Value) Type() string {
return
"float32"
}
func
(
f
*
float32Value
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
*
f
)
}
func
(
f
*
float32Value
)
String
()
string
{
return
strconv
.
FormatFloat
(
float64
(
*
f
),
'g'
,
-
1
,
32
)
}
func
float32Conv
(
sval
string
)
(
interface
{},
error
)
{
v
,
err
:=
strconv
.
ParseFloat
(
sval
,
32
)
...
...
vendor/github.com/spf13/pflag/float64.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// -- float64 Value
type
float64Value
float64
...
...
@@ -23,7 +20,7 @@ func (f *float64Value) Type() string {
return
"float64"
}
func
(
f
*
float64Value
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
*
f
)
}
func
(
f
*
float64Value
)
String
()
string
{
return
strconv
.
FormatFloat
(
float64
(
*
f
),
'g'
,
-
1
,
64
)
}
func
float64Conv
(
sval
string
)
(
interface
{},
error
)
{
return
strconv
.
ParseFloat
(
sval
,
64
)
...
...
vendor/github.com/spf13/pflag/int.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// -- int Value
type
intValue
int
...
...
@@ -23,7 +20,7 @@ func (i *intValue) Type() string {
return
"int"
}
func
(
i
*
intValue
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
*
i
)
}
func
(
i
*
intValue
)
String
()
string
{
return
strconv
.
Itoa
(
int
(
*
i
)
)
}
func
intConv
(
sval
string
)
(
interface
{},
error
)
{
return
strconv
.
Atoi
(
sval
)
...
...
vendor/github.com/spf13/pflag/int32.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// -- int32 Value
type
int32Value
int32
...
...
@@ -23,7 +20,7 @@ func (i *int32Value) Type() string {
return
"int32"
}
func
(
i
*
int32Value
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
*
i
)
}
func
(
i
*
int32Value
)
String
()
string
{
return
strconv
.
FormatInt
(
int64
(
*
i
),
10
)
}
func
int32Conv
(
sval
string
)
(
interface
{},
error
)
{
v
,
err
:=
strconv
.
ParseInt
(
sval
,
0
,
32
)
...
...
vendor/github.com/spf13/pflag/int64.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// -- int64 Value
type
int64Value
int64
...
...
@@ -23,7 +20,7 @@ func (i *int64Value) Type() string {
return
"int64"
}
func
(
i
*
int64Value
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
*
i
)
}
func
(
i
*
int64Value
)
String
()
string
{
return
strconv
.
FormatInt
(
int64
(
*
i
),
10
)
}
func
int64Conv
(
sval
string
)
(
interface
{},
error
)
{
return
strconv
.
ParseInt
(
sval
,
0
,
64
)
...
...
vendor/github.com/spf13/pflag/int8.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// -- int8 Value
type
int8Value
int8
...
...
@@ -23,7 +20,7 @@ func (i *int8Value) Type() string {
return
"int8"
}
func
(
i
*
int8Value
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
*
i
)
}
func
(
i
*
int8Value
)
String
()
string
{
return
strconv
.
FormatInt
(
int64
(
*
i
),
10
)
}
func
int8Conv
(
sval
string
)
(
interface
{},
error
)
{
v
,
err
:=
strconv
.
ParseInt
(
sval
,
0
,
8
)
...
...
vendor/github.com/spf13/pflag/string.go
View file @
6140ab26
package
pflag
import
"fmt"
// -- string Value
type
stringValue
string
...
...
@@ -18,7 +16,7 @@ func (s *stringValue) Type() string {
return
"string"
}
func
(
s
*
stringValue
)
String
()
string
{
return
fmt
.
Sprintf
(
"%s"
,
*
s
)
}
func
(
s
*
stringValue
)
String
()
string
{
return
string
(
*
s
)
}
func
stringConv
(
sval
string
)
(
interface
{},
error
)
{
return
sval
,
nil
...
...
vendor/github.com/spf13/pflag/string_array.go
0 → 100644
View file @
6140ab26
package
pflag
import
(
"fmt"
"strings"
)
var
_
=
fmt
.
Fprint
// -- stringArray Value
type
stringArrayValue
struct
{
value
*
[]
string
changed
bool
}
func
newStringArrayValue
(
val
[]
string
,
p
*
[]
string
)
*
stringArrayValue
{
ssv
:=
new
(
stringArrayValue
)
ssv
.
value
=
p
*
ssv
.
value
=
val
return
ssv
}
func
(
s
*
stringArrayValue
)
Set
(
val
string
)
error
{
if
!
s
.
changed
{
*
s
.
value
=
[]
string
{
val
}
s
.
changed
=
true
}
else
{
*
s
.
value
=
append
(
*
s
.
value
,
val
)
}
return
nil
}
func
(
s
*
stringArrayValue
)
Type
()
string
{
return
"stringArray"
}
func
(
s
*
stringArrayValue
)
String
()
string
{
str
,
_
:=
writeAsCSV
(
*
s
.
value
)
return
"["
+
str
+
"]"
}
func
stringArrayConv
(
sval
string
)
(
interface
{},
error
)
{
sval
=
strings
.
Trim
(
sval
,
"[]"
)
// An empty string would cause a array with one (empty) string
if
len
(
sval
)
==
0
{
return
[]
string
{},
nil
}
return
readAsCSV
(
sval
)
}
// GetStringArray return the []string value of a flag with the given name
func
(
f
*
FlagSet
)
GetStringArray
(
name
string
)
([]
string
,
error
)
{
val
,
err
:=
f
.
getFlagType
(
name
,
"stringArray"
,
stringArrayConv
)
if
err
!=
nil
{
return
[]
string
{},
err
}
return
val
.
([]
string
),
nil
}
// StringArrayVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the values of the multiple flags.
// The value of each argument will not try to be separated by comma
func
(
f
*
FlagSet
)
StringArrayVar
(
p
*
[]
string
,
name
string
,
value
[]
string
,
usage
string
)
{
f
.
VarP
(
newStringArrayValue
(
value
,
p
),
name
,
""
,
usage
)
}
// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.
func
(
f
*
FlagSet
)
StringArrayVarP
(
p
*
[]
string
,
name
,
shorthand
string
,
value
[]
string
,
usage
string
)
{
f
.
VarP
(
newStringArrayValue
(
value
,
p
),
name
,
shorthand
,
usage
)
}
// StringArrayVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the flag.
// The value of each argument will not try to be separated by comma
func
StringArrayVar
(
p
*
[]
string
,
name
string
,
value
[]
string
,
usage
string
)
{
CommandLine
.
VarP
(
newStringArrayValue
(
value
,
p
),
name
,
""
,
usage
)
}
// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.
func
StringArrayVarP
(
p
*
[]
string
,
name
,
shorthand
string
,
value
[]
string
,
usage
string
)
{
CommandLine
.
VarP
(
newStringArrayValue
(
value
,
p
),
name
,
shorthand
,
usage
)
}
// StringArray defines a string flag with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag.
// The value of each argument will not try to be separated by comma
func
(
f
*
FlagSet
)
StringArray
(
name
string
,
value
[]
string
,
usage
string
)
*
[]
string
{
p
:=
[]
string
{}
f
.
StringArrayVarP
(
&
p
,
name
,
""
,
value
,
usage
)
return
&
p
}
// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash.
func
(
f
*
FlagSet
)
StringArrayP
(
name
,
shorthand
string
,
value
[]
string
,
usage
string
)
*
[]
string
{
p
:=
[]
string
{}
f
.
StringArrayVarP
(
&
p
,
name
,
shorthand
,
value
,
usage
)
return
&
p
}
// StringArray defines a string flag with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag.
// The value of each argument will not try to be separated by comma
func
StringArray
(
name
string
,
value
[]
string
,
usage
string
)
*
[]
string
{
return
CommandLine
.
StringArrayP
(
name
,
""
,
value
,
usage
)
}
// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash.
func
StringArrayP
(
name
,
shorthand
string
,
value
[]
string
,
usage
string
)
*
[]
string
{
return
CommandLine
.
StringArrayP
(
name
,
shorthand
,
value
,
usage
)
}
vendor/github.com/spf13/pflag/string_slice.go
View file @
6140ab26
package
pflag
import
(
"bytes"
"encoding/csv"
"fmt"
"strings"
...
...
@@ -21,10 +22,28 @@ func newStringSliceValue(val []string, p *[]string) *stringSliceValue {
return
ssv
}
func
(
s
*
stringSliceValue
)
Set
(
val
string
)
error
{
func
readAsCSV
(
val
string
)
([]
string
,
error
)
{
if
val
==
""
{
return
[]
string
{},
nil
}
stringReader
:=
strings
.
NewReader
(
val
)
csvReader
:=
csv
.
NewReader
(
stringReader
)
v
,
err
:=
csvReader
.
Read
()
return
csvReader
.
Read
()
}
func
writeAsCSV
(
vals
[]
string
)
(
string
,
error
)
{
b
:=
&
bytes
.
Buffer
{}
w
:=
csv
.
NewWriter
(
b
)
err
:=
w
.
Write
(
vals
)
if
err
!=
nil
{
return
""
,
err
}
w
.
Flush
()
return
strings
.
TrimSuffix
(
b
.
String
(),
fmt
.
Sprintln
()),
nil
}
func
(
s
*
stringSliceValue
)
Set
(
val
string
)
error
{
v
,
err
:=
readAsCSV
(
val
)
if
err
!=
nil
{
return
err
}
...
...
@@ -41,7 +60,10 @@ func (s *stringSliceValue) Type() string {
return
"stringSlice"
}
func
(
s
*
stringSliceValue
)
String
()
string
{
return
"["
+
strings
.
Join
(
*
s
.
value
,
","
)
+
"]"
}
func
(
s
*
stringSliceValue
)
String
()
string
{
str
,
_
:=
writeAsCSV
(
*
s
.
value
)
return
"["
+
str
+
"]"
}
func
stringSliceConv
(
sval
string
)
(
interface
{},
error
)
{
sval
=
strings
.
Trim
(
sval
,
"[]"
)
...
...
@@ -49,8 +71,7 @@ func stringSliceConv(sval string) (interface{}, error) {
if
len
(
sval
)
==
0
{
return
[]
string
{},
nil
}
v
:=
strings
.
Split
(
sval
,
","
)
return
v
,
nil
return
readAsCSV
(
sval
)
}
// GetStringSlice return the []string value of a flag with the given name
...
...
vendor/github.com/spf13/pflag/uint.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// -- uint Value
type
uintValue
uint
...
...
@@ -23,7 +20,7 @@ func (i *uintValue) Type() string {
return
"uint"
}
func
(
i
*
uintValue
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
*
i
)
}
func
(
i
*
uintValue
)
String
()
string
{
return
strconv
.
FormatUint
(
uint64
(
*
i
),
10
)
}
func
uintConv
(
sval
string
)
(
interface
{},
error
)
{
v
,
err
:=
strconv
.
ParseUint
(
sval
,
0
,
0
)
...
...
vendor/github.com/spf13/pflag/uint16.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// -- uint16 value
type
uint16Value
uint16
...
...
@@ -12,7 +9,7 @@ func newUint16Value(val uint16, p *uint16) *uint16Value {
*
p
=
val
return
(
*
uint16Value
)(
p
)
}
func
(
i
*
uint16Value
)
String
()
string
{
return
fmt
.
Sprintf
(
"%d"
,
*
i
)
}
func
(
i
*
uint16Value
)
Set
(
s
string
)
error
{
v
,
err
:=
strconv
.
ParseUint
(
s
,
0
,
16
)
*
i
=
uint16Value
(
v
)
...
...
@@ -23,6 +20,8 @@ func (i *uint16Value) Type() string {
return
"uint16"
}
func
(
i
*
uint16Value
)
String
()
string
{
return
strconv
.
FormatUint
(
uint64
(
*
i
),
10
)
}
func
uint16Conv
(
sval
string
)
(
interface
{},
error
)
{
v
,
err
:=
strconv
.
ParseUint
(
sval
,
0
,
16
)
if
err
!=
nil
{
...
...
vendor/github.com/spf13/pflag/uint32.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// -- uint
16
value
// -- uint
32
value
type
uint32Value
uint32
func
newUint32Value
(
val
uint32
,
p
*
uint32
)
*
uint32Value
{
*
p
=
val
return
(
*
uint32Value
)(
p
)
}
func
(
i
*
uint32Value
)
String
()
string
{
return
fmt
.
Sprintf
(
"%d"
,
*
i
)
}
func
(
i
*
uint32Value
)
Set
(
s
string
)
error
{
v
,
err
:=
strconv
.
ParseUint
(
s
,
0
,
32
)
*
i
=
uint32Value
(
v
)
...
...
@@ -23,6 +20,8 @@ func (i *uint32Value) Type() string {
return
"uint32"
}
func
(
i
*
uint32Value
)
String
()
string
{
return
strconv
.
FormatUint
(
uint64
(
*
i
),
10
)
}
func
uint32Conv
(
sval
string
)
(
interface
{},
error
)
{
v
,
err
:=
strconv
.
ParseUint
(
sval
,
0
,
32
)
if
err
!=
nil
{
...
...
vendor/github.com/spf13/pflag/uint64.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// -- uint64 Value
type
uint64Value
uint64
...
...
@@ -23,7 +20,7 @@ func (i *uint64Value) Type() string {
return
"uint64"
}
func
(
i
*
uint64Value
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
*
i
)
}
func
(
i
*
uint64Value
)
String
()
string
{
return
strconv
.
FormatUint
(
uint64
(
*
i
),
10
)
}
func
uint64Conv
(
sval
string
)
(
interface
{},
error
)
{
v
,
err
:=
strconv
.
ParseUint
(
sval
,
0
,
64
)
...
...
vendor/github.com/spf13/pflag/uint8.go
View file @
6140ab26
package
pflag
import
(
"fmt"
"strconv"
)
import
"strconv"
// -- uint8 Value
type
uint8Value
uint8
...
...
@@ -23,7 +20,7 @@ func (i *uint8Value) Type() string {
return
"uint8"
}
func
(
i
*
uint8Value
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
*
i
)
}
func
(
i
*
uint8Value
)
String
()
string
{
return
strconv
.
FormatUint
(
uint64
(
*
i
),
10
)
}
func
uint8Conv
(
sval
string
)
(
interface
{},
error
)
{
v
,
err
:=
strconv
.
ParseUint
(
sval
,
0
,
8
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment