-
Notifications
You must be signed in to change notification settings - Fork 86
golang lint ci v2 oadp 1.5 #2070
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
base: oadp-1.5
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,127 +1,102 @@ | ||||||
| # Documentation reference https://github.com/golangci/golangci-lint/blob/v1.55.2/.golangci.reference.yml | ||||||
| version: "2" | ||||||
| run: | ||||||
| skip-dirs-use-default: false | ||||||
| modules-download-mode: readonly | ||||||
| allow-parallel-runners: false | ||||||
|
|
||||||
| output: | ||||||
| format: colored-line-number | ||||||
| print-issued-lines: true | ||||||
| print-linter-name: true | ||||||
| uniq-by-line: true | ||||||
| sort-results: true | ||||||
|
|
||||||
| linters-settings: | ||||||
| dogsled: | ||||||
| max-blank-identifiers: 2 | ||||||
| errcheck: | ||||||
| check-type-assertions: true | ||||||
| check-blank: true | ||||||
| gci: | ||||||
| sections: | ||||||
| - standard | ||||||
| - default | ||||||
| - prefix(github.com/openshift/oadp-operator) | ||||||
| goconst: | ||||||
| min-len: 3 | ||||||
| min-occurrences: 5 | ||||||
| gofmt: | ||||||
| simplify: true | ||||||
| goheader: | ||||||
| # copy from ./hack/boilerplate.go.txt | ||||||
| template: |- | ||||||
| Copyright 2021. | ||||||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
| you may not use this file except in compliance with the License. | ||||||
| You may obtain a copy of the License at | ||||||
| http://www.apache.org/licenses/LICENSE-2.0 | ||||||
| Unless required by applicable law or agreed to in writing, software | ||||||
| distributed under the License is distributed on an "AS IS" BASIS, | ||||||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
| See the License for the specific language governing permissions and | ||||||
| limitations under the License. | ||||||
| govet: | ||||||
| enable-all: true | ||||||
| misspell: | ||||||
| locale: US | ||||||
| nakedret: | ||||||
| max-func-lines: 30 | ||||||
| nolintlint: | ||||||
| allow-unused: false | ||||||
| allow-no-explanation: [] | ||||||
| require-explanation: true | ||||||
| require-specific: true | ||||||
| revive: | ||||||
| # TODO enable! | ||||||
| # enable-all-rules: true | ||||||
| rules: | ||||||
| - name: line-length-limit | ||||||
| disabled: true | ||||||
| # TODO delete after | ||||||
| - name: blank-imports | ||||||
| - name: dot-imports | ||||||
| - name: duplicated-imports | ||||||
| - name: import-alias-naming | ||||||
| - name: import-shadowing | ||||||
| - name: redundant-import-alias | ||||||
| unparam: | ||||||
| check-exported: true | ||||||
|
|
||||||
| linters: | ||||||
| disable-all: true | ||||||
| # TODO enable commented ones | ||||||
| default: none | ||||||
|
||||||
| default: none | |
| disable-all: true |
Copilot
AI
Jan 19, 2026
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.
Critical linters have been removed from the enabled list that were previously active. Important linters like 'errcheck' (checks for unchecked errors), 'gosimple' (simplification suggestions), 'govet' (Go's built-in vet tool), 'ineffassign' (detects ineffectual assignments), 'staticcheck' (comprehensive static analysis), 'unused' (finds unused code), 'gosec' (security checks), 'misspell' (spelling), 'gofmt' (formatting), and 'gci' (import ordering) are no longer enabled. These linters provide essential code quality and security checks. Consider re-enabling these linters unless there is a specific reason to disable them.
Copilot
AI
Jan 19, 2026
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.
Settings for 'errcheck', 'goconst', 'goheader', 'govet', and 'misspell' linters are configured, but these linters are not enabled in the 'linters.enable' list. These settings will have no effect unless the corresponding linters are also enabled. Either remove these unused settings or add the linters to the enabled list.
Copilot
AI
Jan 19, 2026
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.
The configuration structure has been changed incorrectly. In golangci-lint v1.x, linter settings should be under a top-level 'linters-settings' section, not nested under 'linters.settings'. The current structure 'linters.settings' is not valid for golangci-lint v1.x and will likely cause configuration parsing errors.
Copilot
AI
Jan 19, 2026
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.
The 'linters.exclusions' section is not a valid configuration structure in golangci-lint v1.x. Exclusion rules should be under 'issues.exclude-rules' or 'issues.exclude-dirs' at the top level, not nested under 'linters.exclusions'. This configuration will not work as intended.
Copilot
AI
Jan 19, 2026
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.
The 'severity.default' field uses 'error' instead of 'default-severity: error'. In golangci-lint v1.x configuration, the correct field name is 'default-severity', not 'default'. This should be corrected to match the v1.x configuration format.
| default: error | |
| default-severity: error |
Copilot
AI
Jan 19, 2026
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.
The 'formatters' section is not a standard golangci-lint configuration section in v1.x. Formatters like 'gci' and 'gofmt' should be enabled as linters in the 'linters.enable' list, not in a separate 'formatters' section. This configuration structure will not be recognized by golangci-lint v1.x.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ DEFAULT_VERSION := 1.5.4 | |||||
| VERSION ?= $(DEFAULT_VERSION) | ||||||
| OPERATOR_SDK_VERSION ?= v1.34.2 | ||||||
| ENVTEST_K8S_VERSION = 1.32 #refers to the version of kubebuilder assets to be downloaded by envtest binary # Kubernetes version from OpenShift 4.19.x | ||||||
| GOLANGCI_LINT_VERSION ?= v1.55.2 | ||||||
| GOLANGCI_LINT_VERSION ?= v2.1.2 | ||||||
| KUSTOMIZE_VERSION ?= v5.2.1 | ||||||
| CONTROLLER_TOOLS_VERSION ?= v0.16.5 | ||||||
| OPM_VERSION ?= v1.23.0 | ||||||
|
|
@@ -193,11 +193,17 @@ test: check-go vet envtest ## Run unit tests; run Go linters checks; check if ap | |||||
| @make bundle-isupdated | ||||||
| @make check-go-dependencies | ||||||
|
|
||||||
| # Lint CLI needs to be built from the same toolchain version | ||||||
| GOLANGCI_LINT = $(LOCALBIN)/$(BRANCH_VERSION)/golangci-lint | ||||||
| .PHONY: golangci-lint | ||||||
| golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. | ||||||
| $(GOLANGCI_LINT): $(LOCALBIN) | ||||||
| $(call go-install-tool-branch,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)) | ||||||
| @if [ -f $(GOLANGCI_LINT) ] && $(GOLANGCI_LINT) --version | grep -q $(GOLANGCI_LINT_VERSION); then \ | ||||||
| echo "golangci-lint $(GOLANGCI_LINT_VERSION) is already installed"; \ | ||||||
| else \ | ||||||
| echo "Installing golangci-lint $(GOLANGCI_LINT_VERSION)"; \ | ||||||
| $(call go-install-tool-branch,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)); \ | ||||||
|
||||||
| $(call go-install-tool-branch,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)); \ | |
| $(call go-install-tool-branch,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)); \ |
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.
The 'version: "2"' configuration format does not exist for golangci-lint. The golangci-lint configuration file does not use a version field in this manner. This line should be removed as it's not a valid configuration option for golangci-lint v1.x.