-
Notifications
You must be signed in to change notification settings - Fork 3
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
ci: integrate golangci-lint with new workflow #41
Conversation
- Renamed .github/workflows/go.yml to go-standards.yml - Integrated golangci-lint into the Go Standards workflow - Updated golangci-lint configuration to optimize for CI workflows - Added comments and detailed explanations to the workflow and configuration files - Utilized latest GitHub actions versions, including actions/upload-artifact@v4 This commit enhances code quality checks by incorporating comprehensive linting and ensuring compatibility with the latest GitHub actions.
- Fixed unchecked errors in the Clipper CLI tool. - Corrected variable names to follow naming conventions. These changes ensure the code meets the quality standards set by GolangCI and improve code readability and maintainability.
- Fixed issues reported by golangci-lint in the Clipper CLI tool. - Updated test files to address linting errors. - Enhanced code quality and ensured compliance with linting rules. This commit improves code quality by adhering to golangci-lint standards, enhancing maintainability and readability.
- Adjusted golangci-lint action configuration to generate checkstyle-formatted report. - Updated artifact upload step to reflect new report file format.
- To ensure we always run on the latest stable version of Go we will use the stable option as review by @ccoVeile
@@ -1,151 +1,82 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice rework.
I'm curious, where did you find this setting? Did you use an official golangci-lint one and adapted it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I wrote that by consulting the GolangCI docs and the helper linters command provided by the CLI tool. I didn't find a ready-made config that fit, so I used a trial-and-error approach, adjusting values, checking results, and researching as needed. It's definitely not the best option out there but it tackles the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find a ready-made config that fit, so I used a trial-and-error approach, adjusting values, checking results, and researching as needed.
That's exactly why I started working on
https://github.com/ccoVeille/golangci-lint-config-examples
I only worked on the first steps. I will provide more examples after my holidays
} | ||
|
||
// IsCIEnvironment checks if the code is running in a CI environment. | ||
func IsCIEnvironment() bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like what you did.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I presumed I would use this quite a few later, always nice to have a helper/utility function and avoid code repetitions.
|
||
// IsCIEnvironment checks if the code is running in a CI environment. | ||
func IsCIEnvironment() bool { | ||
return os.Getenv("GITHUB_ACTIONS") == "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a regular and documented env variable?
I've never seen it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, I've searched for a way to use environment variables approach as you suggested before and found this at Learn Github Actions - Variables
It says the following:
GITHUB_ACTIONS
Always set to true
when GitHub Actions is running the workflow. You can use this variable to differentiate when tests are being run locally or by GitHub Actions.
Which as the descriptions suggests it fits perfectly for this case.
Tasks
This commit aims to enhance code quality checks by incorporating comprehensive linting and ensuring compatibility with the latest GitHub actions.