Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.
This repository was archived by the owner on May 26, 2023. It is now read-only.

Support for fixed-size integer types #31

@safety-tom

Description

@safety-tom

Hi there, would you accept a PR that adds support for fixed-size integer types?

Motivation

When using smaller types (e.g. int8, uint16) users need to manually cast int/uint and perform bounds checking.

Proposal

It would look like this:

flag.Uint16Var(&HTTPPort, "port", 8080, "A port")

This code would induce a panic (as opposed to a silent wrap-around):

f := 65536  // doesn't fit in a uint16
flag.Uint16Var(&HTTPPort, "port", 8080, "A port")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions