Skip to content
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

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

dfinkel
Copy link
Contributor

@dfinkel dfinkel commented Jan 29, 2024

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.

Copy link
Contributor

@sergiosalvatore sergiosalvatore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few documentation nits.

return &UnsignedIntegralSliceFlag[I]{s: s}
}

// Set implement pflag.Value and flag.Value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/implement/implements/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

return &SignedIntegralSliceFlag[I]{s: s}
}

// Set implement pflag.Value and flag.Value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/implement/implements/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

"github.com/vimeo/dials/parse"
)

// SignedInts represents all signed integer types
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/SignedInts/SignedInt/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

"github.com/vimeo/dials/parse"
)

// SignedInts represents all signed integer types
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/SignedInts/UnsignedInt/

Copy link
Contributor Author

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)

uint8 | uint16 | uint32 | uint64 | uint | uintptr
}

// SignedIntegralSliceFlag is a wrapper around an integral-typed slice
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/SignedIntegralSliceFlag/UnsignedIntegralSliceFlag/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

s *[]I
}

// NewStringSliceFlag is a constructor for StringSliceFlag
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/NewStringSliceFlag/NewUnsignedIntegralSlice/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -78,6 +79,7 @@ func TestDefaultVals(t *testing.T) {
type otherUint16 uint16
type otherUint32 uint32
type otherUint64 uint64
type otherUintptr uint64

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?

Copy link
Contributor Author

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.
@dfinkel dfinkel force-pushed the flag_integral_type_slice_support branch from 852a1cf to ba90168 Compare January 29, 2024 22:00
Base automatically changed from parse_integral_type_slice_helpers to master January 29, 2024 22:10
@dfinkel dfinkel merged commit 023c057 into master Jan 29, 2024
6 checks passed
@dfinkel dfinkel deleted the flag_integral_type_slice_support branch January 29, 2024 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants