jgautheron/goconst

More options for golangci-lint

Antonboom opened this issue · 5 comments

Hello!

I can see that the linter has a rich set of flags:

  -ignore            exclude files matching the given regular expression
  -ignore-tests      exclude tests from the search (default: true)
  -min-occurrences   report from how many occurrences (default: 2)
  -min-length        only report strings with the minimum given length (default: 3)
  -match-constant    look for existing constants matching the values
  -numbers           search also for duplicated numbers

but only a couple of options are available here

goconst:
    min-len: 3
    min-occurrences: 3

It would be very useful for us to ignore some constants, or turn off this linter for tests without touching other linters

Could you help with that? Thanks

Hi,
The flag must be exposed in golangci-lint, also probably the vendored version in the project is outdated.
There's not much I can do on my side, I'd recommend creating an issue or better even a PR, in the golangci-lint repository.

@jgautheron, please, look at golangci/golangci-lint#1495 (comment)

Can we add the missing API to ditch the golangci-lint/goconst fork entirely?

if necessary, we can just open the PR from the fork :)

CC: @iwankgb

@Antonboom this should do it: ce0d7c0

I added the API facade and exposed more parameters. The ignore parameters are irrelevant in the context of golangci-lint since they are handled by the the tool.

@jgautheron, thank u!

With your permission, I left a couple of comments on the commit above.

Good catch @Antonboom, updated: b58d7cf
Thanks!