-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flag: support for integral slices #85
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few documentation nits.
sources/flag/flaghelper/uints.go
Outdated
return &UnsignedIntegralSliceFlag[I]{s: s} | ||
} | ||
|
||
// Set implement pflag.Value and flag.Value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/implement/implements/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
sources/flag/flaghelper/ints.go
Outdated
return &SignedIntegralSliceFlag[I]{s: s} | ||
} | ||
|
||
// Set implement pflag.Value and flag.Value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/implement/implements/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
sources/flag/flaghelper/ints.go
Outdated
"github.com/vimeo/dials/parse" | ||
) | ||
|
||
// SignedInts represents all signed integer types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/SignedInts/SignedInt/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
sources/flag/flaghelper/uints.go
Outdated
"github.com/vimeo/dials/parse" | ||
) | ||
|
||
// SignedInts represents all signed integer types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/SignedInts/UnsignedInt/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, right, golint
gets unhappy with generics-related things.
Thanks!
(fixed)
sources/flag/flaghelper/uints.go
Outdated
uint8 | uint16 | uint32 | uint64 | uint | uintptr | ||
} | ||
|
||
// SignedIntegralSliceFlag is a wrapper around an integral-typed slice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/SignedIntegralSliceFlag/UnsignedIntegralSliceFlag/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
sources/flag/flaghelper/uints.go
Outdated
s *[]I | ||
} | ||
|
||
// NewStringSliceFlag is a constructor for StringSliceFlag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/NewStringSliceFlag/NewUnsignedIntegralSlice/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
sources/flag/flag_test.go
Outdated
@@ -78,6 +79,7 @@ func TestDefaultVals(t *testing.T) { | |||
type otherUint16 uint16 | |||
type otherUint32 uint32 | |||
type otherUint64 uint64 | |||
type otherUintptr uint64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this supposed to be uintptr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it is!
Fixed!
Also, add uintptr support. Extend the existing test cases to be comprehensive over the set of integer-types we support as well as integer slices.
852a1cf
to
ba90168
Compare
Also, add uintptr support.
Extend the existing test cases to be comprehensive over the set of
integer-types we support as well as integer slices.