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

implement golangci-lint feature and fix linter Errors #300

Merged
merged 11 commits into from
Aug 12, 2024

Conversation

viveksahu26
Copy link
Collaborator

Description

Why we need this ?

This pull request introduces a comprehensive golangci-lint CI/CD pipeline setup to enforce coding standards and improve code quality across the project. Let's understand why we need this:

  • whether it's a maintainer or a contributor everyone does mistake on revieving code or writing code respectively from coding perspective because no one is perfect. These are not big mistakes but a tiny mistakes but important such as:
    • not following CamelCase for writing variable names.
    • not handling error after error is being thrown and hide it with "_" variable
    • providing more permission on writing files than it requires
    • not formatting the code according to the standard of the project
    • mis-spelled of some variables or function
    • not making use of arguments passed in the function
    • declared variables, imports, or functions but not used
    • leaving a blank line or whitespace
    • and many such things.

To handle such errors golang provides wide range of linters i.e. 50+ linters such as gofmt, govet, and many more mentioned here. But no one want to import each one of them in your package manually. Therefore, to solve this we have golangci-lint. It is the preferred Go linters aggregator that covers most the linters you’ll ever need. It runs these linters in parallel and reuses the build cache for improved performance during development.

What changes are being made ?

  • Added golangci-lint.yaml with configured linters and settings in a github worflow, which will be triggered on each PR made to the main branch.
  • Added the configuration file of golangci-lint in golangci.yml to include linting steps and all linters to process.
  • Ran locally these errors and resolved all the identified linting errors to adhere to the new standards and configurations.

Resources:

Signed-off-by: Vivek Kumar Sahu <[email protected]>
Signed-off-by: Vivek Kumar Sahu <[email protected]>
Signed-off-by: Vivek Kumar Sahu <[email protected]>
Signed-off-by: Vivek Kumar Sahu <[email protected]>
Signed-off-by: Vivek Kumar Sahu <[email protected]>
Signed-off-by: Vivek Kumar Sahu <[email protected]>
Signed-off-by: Vivek Kumar Sahu <[email protected]>
riteshnoronha
riteshnoronha previously approved these changes Jul 30, 2024
@riteshnoronha
Copy link
Contributor

@viveksahu26 need to resolve conflicts

@viveksahu26
Copy link
Collaborator Author

Hey @riteshnoronha , any update on this ?

@riteshnoronha
Copy link
Contributor

@viveksahu26 lets resolve the conflicts then we can merge this in

@viveksahu26
Copy link
Collaborator Author

Hey @riteshnoronha , merged conflict is resolved now !!

@riteshnoronha riteshnoronha merged commit 21368bb into interlynk-io:main Aug 12, 2024
3 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.

2 participants