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

Add linters #2403

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add linters #2403

wants to merge 1 commit into from

Conversation

AnkushinDaniil
Copy link
Contributor

This pull request includes multiple changes aimed at improving the codebase by optimizing loops and adding new linters. The most significant changes include replacing traditional for loops with range loops, adding new linters to the configuration, and optimizing array initialization.

Loop Optimization:

Linter Configuration:

  • .golangci.yaml: Added new linters prealloc, makezero, and intrange to the configuration.

Array Initialization:

* prealloc
* makezero
* intrange
Copy link

codecov bot commented Jan 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.45%. Comparing base (61d810a) to head (d6769a6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2403      +/-   ##
==========================================
- Coverage   74.48%   74.45%   -0.04%     
==========================================
  Files         113      113              
  Lines       13020    13019       -1     
==========================================
- Hits         9698     9693       -5     
- Misses       2587     2592       +5     
+ Partials      735      734       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@weiihann
Copy link
Contributor

makezero and prealloc seems good to me.

For intrange, I'm not sure if it actually helps. Personally, it does not help with improving code readability. For example, I'd prefer to see for i := 0; i < len(something); i++ since it's clear to me that it starts at 0 and ends at len(something) - 1. For for i := range len(something), I still have to think about what it actually starts from. Performance wise, I think both are the same? Not super against adding it, but I don't see the benefit of it for now.

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.

2 participants