Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@quasilyte
Copy link
Member

From the golang/go#41792

And these are invalid flag names:

    * Empty String:

      * If the flag name is an empty string and is used in the `-flag x` form, the flag starting with hyphen('-''') can be the non-flag argument and the flag starting with double hyphen('--''') can be the terminator.
      * > Flag parsing stops just before the first non-flag argument("-" is a non-flag argument) or after the terminator "--".

    * Starting with hyphen:

      * According to the document the flag should start with '-' or '--'. But, if the flag name starts with hyphen, this package can’t distinguish between '-''-flag' and '--''flag'.

    * Containing equal sign:

      * This package uses equal sign to split the flag into a name-value pair. So, if the flag name contains equal sign, this package can't split it properly.
      * e.g. If the flag name is 'foo=bar' and the flag is '-foo=bar=value', this package can't find out the actual value.

Signed-off-by: Iskander Sharipov [email protected]

From the golang/go#41792

    And these are invalid flag names:

        * Empty String:

          * If the flag name is an empty string and is used in the `-flag x` form, the flag starting with hyphen('-''') can be the non-flag argument and the flag starting with double hyphen('--''') can be the terminator.
          * > Flag parsing stops just before the first non-flag argument("-" is a non-flag argument) or after the terminator "--".

        * Starting with hyphen:

          * According to the document the flag should start with '-' or '--'. But, if the flag name starts with hyphen, this package can’t distinguish between '-''-flag' and '--''flag'.

        * Containing equal sign:

          * This package uses equal sign to split the flag into a name-value pair. So, if the flag name contains equal sign, this package can't split it properly.
          * e.g. If the flag name is 'foo=bar' and the flag is '-foo=bar=value', this package can't find out the actual value.

Signed-off-by: Iskander Sharipov <[email protected]>
Copy link
Member

@cristaloleg cristaloleg left a comment

Choose a reason for hiding this comment

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

🚀

@quasilyte quasilyte merged commit 5819974 into master Nov 20, 2020
@quasilyte quasilyte deleted the quasilyte/flagName/add_more_checks branch November 20, 2020 10:30
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