Skip to content

Conversation

@kalexmills
Copy link
Contributor

@kalexmills kalexmills commented Apr 5, 2025

Adds a flag for finding and reporting on duplicate constants, along with tests.
Also adds backwards-compatible fields to the Issue API for eventual use in golangci-lint.

I went ahead and set this new flag in the benchmarks, since it will result in additional allocations when set.

I'm open to making any changes requested by maintainers. Just let me know.

There are a few extensions I can imagine, but not all of them are quite as easy to implement.

  • Limiting search within the same file, within the same package, or across packages. Currently this feature searches only across packages.
  • Ignoring unexported constants when checking for duplicates.
  • Adding support for constant expressions.

Closes #29.

@kalexmills kalexmills changed the title feat: add find-duplicates flag Add find-duplicates flag Apr 5, 2025
@kalexmills kalexmills changed the title Add find-duplicates flag Add support for finding constants with duplicated values. Apr 5, 2025
@jgautheron jgautheron force-pushed the find-duplicate-constants branch 2 times, most recently from 99be201 to 401729b Compare April 6, 2025 16:51
@jgautheron jgautheron force-pushed the find-duplicate-constants branch from 401729b to dc78c1a Compare April 6, 2025 16:53
@codecov
Copy link

codecov bot commented Apr 6, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@jgautheron
Copy link
Owner

Hey @kalexmills thanks for the contribution, lgtm!

@jgautheron jgautheron merged commit d8efeb9 into jgautheron:master Apr 6, 2025
6 checks passed
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.

Find duplicate constants

2 participants