Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace interface{} with any #6751

Merged
merged 2 commits into from
May 27, 2024

Conversation

nikpivkin
Copy link
Contributor

@nikpivkin nikpivkin commented May 22, 2024

Description

any is an alias of interface{}. any is more concise and better reflects its purpose.

Just run gofmt -w -r 'interface{} -> any' $(find . -name "*.go" ! -name "mock_*" ! -name "*twirp.go" ! -name "*pb.go" ! -name "*_gen.go")

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@nikpivkin nikpivkin marked this pull request as ready for review May 22, 2024 14:41
@simar7
Copy link
Member

simar7 commented May 22, 2024

Since they are interchangeable, I'm fine with the actual change. However I do have a few small concerns:

  1. It's not easy to review this PR for any accidental changes.
  2. The commit history is affected for many lines.
  3. (not so relevant) It only works with Go 1.18 and newer.

I reviewed the pkg/iac directory so far.

@knqyf263
Copy link
Collaborator

I'm also okay with these changes, although it's hard to review all of them. For the future, what if we introduce a linter to enforce any? Then, we can auto-fix them with golangci-lint—- fix.

@nikpivkin
Copy link
Contributor Author

@knqyf263 Should the golangci-lint configuration be updated in another PR?

@knqyf263
Copy link
Collaborator

Did you find such a linter?

@nikpivkin
Copy link
Contributor Author

@knqyf263
Copy link
Collaborator

knqyf263 commented May 24, 2024

I didn't know golangci-lint can define such replaces. We want to add the rule in this PR.

@knqyf263 knqyf263 added this pull request to the merge queue May 27, 2024
Merged via the queue into aquasecurity:main with commit ebb123f May 27, 2024
12 checks passed
@nikpivkin nikpivkin deleted the interface-any branch May 27, 2024 04:28
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.

None yet

3 participants