ci: add pr checks workflow#9
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds CI/CD infrastructure for automated linting of Go code by introducing a golangci-lint configuration file and a GitHub Actions workflow to run linting checks on pull requests.
Changes:
- Added
.golangci.ymlconfiguration file with linter settings for Go code quality checks - Added
.github/workflows/lint.ymlworkflow to run golangci-lint on pull requests to the canary branch
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| .golangci.yml | Configures golangci-lint with various linters and rules for Go code quality enforcement |
| .github/workflows/lint.yml | Defines GitHub Actions workflow to run golangci-lint on pull requests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| version: "2" | ||
|
|
||
| linters: | ||
| default: standard |
There was a problem hiding this comment.
The 'default' field under 'linters' is not a valid configuration option in golangci-lint. If you want to enable default linters, you don't need to specify anything, or you can use 'disable-all: false'. If 'standard' refers to a preset, there is no such preset in golangci-lint configuration. This line should be removed or replaced with valid configuration options like 'enable-all', 'disable-all', 'enable', or 'disable'.
| settings: | ||
| errcheck: | ||
| check-type-assertions: true | ||
| govet: | ||
| enable-all: true | ||
| disable: | ||
| - fieldalignment | ||
| gocritic: | ||
| enabled-tags: | ||
| - diagnostic | ||
| - style | ||
| - performance | ||
| revive: | ||
| rules: | ||
| - name: blank-imports | ||
| - name: exported | ||
| - name: unreachable-code | ||
| - name: unused-parameter |
There was a problem hiding this comment.
The golangci-lint configuration structure is incorrect. The 'settings' section should be a top-level key, not nested under 'linters'. According to golangci-lint v2 configuration format, the correct structure should have 'linters' and 'linters-settings' as separate top-level keys. The 'settings' section should be moved out from under 'linters' and renamed to 'linters-settings'.
| exclusions: | ||
| presets: | ||
| - std-error-handling | ||
| rules: | ||
| - path: '(.+)_test\.go' | ||
| linters: | ||
| - errcheck | ||
| - text: 'unused-parameter' | ||
| source: 'cobra\.Command' |
There was a problem hiding this comment.
The 'exclusions' section should be a top-level key named 'issues', not nested under 'linters'. According to golangci-lint v2 configuration format, exclusions should be configured under a top-level 'issues' key with 'exclude-rules' for rule-based exclusions. This section should be moved out from under 'linters' and restructured accordingly.
| exclusions: | |
| presets: | |
| - std-error-handling | |
| rules: | |
| - path: '(.+)_test\.go' | |
| linters: | |
| - errcheck | |
| - text: 'unused-parameter' | |
| source: 'cobra\.Command' | |
| issues: | |
| exclude-rules: | |
| - path: '(.+)_test\.go' | |
| linters: | |
| - errcheck | |
| - text: 'unused-parameter' | |
| source: 'cobra\.Command' |
No description provided.