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

refactor: Replace all interface{} to any alias #805

Merged
merged 2 commits into from
Sep 16, 2022

Conversation

shahzadlone
Copy link
Member

@shahzadlone shahzadlone commented Sep 15, 2022

Relevant issue(s)

Resolves #456

Description

  • Replace all occurrences of interface{} with any in all *.go files.
  • Add linter rule to ensure any is always used over interface{}.

Command used: find . -type f -name "*.go" -print0 | xargs -0 sed -i "s/interface{}/any/g"

Tasks

  • I made sure the code is well commented, particularly hard-to-understand areas.
  • I made sure the repository-held documentation is changed accordingly.
  • I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in tools/configs/chglog/config.yml).
  • I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

How has this been tested?

CI and Locally

Specify the platform(s) on which this was tested:

  • Arch Linux

@shahzadlone shahzadlone added refactor This issue specific to or requires *notable* refactoring of existing codebases and components action/no-benchmark Skips the action that runs the benchmark. labels Sep 15, 2022
@shahzadlone shahzadlone self-assigned this Sep 15, 2022
@shahzadlone shahzadlone added this to the DefraDB v0.3.1 milestone Sep 15, 2022
@shahzadlone shahzadlone force-pushed the lone/refactor/interface-to-any branch 2 times, most recently from b640e3e to 8d2cdd8 Compare September 15, 2022 19:35
@shahzadlone shahzadlone marked this pull request as ready for review September 15, 2022 19:37
@shahzadlone shahzadlone requested a review from a team September 15, 2022 19:37
@codecov
Copy link

codecov bot commented Sep 15, 2022

Codecov Report

Merging #805 (354897d) into develop (39033f1) will not change coverage.
The diff coverage is 85.79%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #805   +/-   ##
========================================
  Coverage    59.55%   59.55%           
========================================
  Files          154      154           
  Lines        17219    17219           
========================================
  Hits         10254    10254           
  Misses        6039     6039           
  Partials       926      926           
Impacted Files Coverage Δ
cli/cli.go 20.31% <ø> (ø)
cli/peerid.go 37.28% <0.00%> (ø)
core/crdt/composite.go 78.87% <0.00%> (ø)
datastore/badger/v3/compat_logger.go 0.00% <0.00%> (ø)
db/collection_delete.go 29.41% <0.00%> (ø)
db/db.go 66.37% <ø> (ø)
net/api/pb/api.pb.go 1.33% <0.00%> (ø)
net/pb/net.pb.go 13.75% <0.00%> (ø)
db/collection_update.go 55.47% <16.66%> (ø)
db/query.go 66.03% <40.00%> (ø)
... and 44 more

@shahzadlone shahzadlone force-pushed the lone/refactor/interface-to-any branch 2 times, most recently from ebea721 to 38e235d Compare September 15, 2022 19:45
Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

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

Approved without reading, should be fine so long as it builds (and you havent snuck anything else in here lol)

@orpheuslummis
Copy link
Contributor

orpheuslummis commented Sep 15, 2022

question(non-blocking): it changes files in autogenerarted files. i wonder if when autoregenerating, i saw ones using protoc-gen-gogo i'm not sure if that's exhaustive, it will go back to interface{}

Copy link
Contributor

@orpheuslummis orpheuslummis left a comment

Choose a reason for hiding this comment

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

LGTM. skimmed through very fast and the pattern seemed consistent. it builds, tests are passing, ...

Copy link
Collaborator

@fredcarle fredcarle left a comment

Choose a reason for hiding this comment

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

LGTM!

@shahzadlone
Copy link
Member Author

shahzadlone commented Sep 16, 2022

question(non-blocking): it changes files in autogenerarted files. i wonder if when autoregenerating, i saw ones using protoc-gen-gogo i'm not sure if that's exhaustive, it will go back to interface{}

I am not to sure about that, this should have replaced it in all *.go files. We can see if that does happen and linter complains we can add a rule for it.

@shahzadlone shahzadlone merged commit 89c6a8f into develop Sep 16, 2022
@shahzadlone shahzadlone deleted the lone/refactor/interface-to-any branch September 16, 2022 04:00
shahzadlone added a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
- Resolves: sourcenetwork#456 
- Replace all occurrences of `interface{}` with `any` in all *.go files.
- Add linter rule to ensure `any` is always used over `interface{}`.

Command used: `find . -type f -name "*.go" -print0 | xargs -0 sed -i "s/interface{}/any/g"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/no-benchmark Skips the action that runs the benchmark. refactor This issue specific to or requires *notable* refactoring of existing codebases and components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace interface{} with any after we bump up to v1.18
4 participants