Skip to content

Conversation

@LukeShu
Copy link
Contributor

@LukeShu LukeShu commented Sep 3, 2021

The gci command line parses the -local flag using the gci.ParseLocalFlag helper function,
which is different than strings.Split (which golangci-lint uses) in that it handles the empty string (which golangci-lint separately handles)
and that it handles empty entries in the list (which golangci-lint does not handle).

For example, the gci command line parses "-local foo,,bar" as the list ["foo", "bar"], but golangci-lint parses the YAML "local-prefixes: foo,,bar" as the list ["foo", "", "bar"].

This is a silly discrepancy to have; just use the gci.ParseLocalFlag helper function!

The gci command line parses the -local flag using the gci.ParseLocalFlag
helper function, which is different than strings.Split (which
golangci-lint uses) in that it handles the empty string (which
golangci-lint separately handles) and that it handles empty entries in the
list (which golangci-lint does not handle).

For example, the gci command line parses "-local foo,,bar" as the list
["foo", "bar"], but golangci-lint parses the YAML
"local-prefixes: foo,,bar" as the list ["foo", "", "bar"].

This is a silly discrepancy to have; just use the gci.ParseLocalFlag
helper function!
@ldez ldez added the enhancement New feature or improvement label Sep 3, 2021
@ldez ldez merged commit 54f4301 into golangci:master Sep 4, 2021
SeigeC pushed a commit to SeigeC/golangci-lint that referenced this pull request Apr 4, 2023
@ldez ldez added this to the v1.42 milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants