-
Notifications
You must be signed in to change notification settings - Fork 4.6k
upgrade: golangci-lint to v2 #22648
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
Merged
+255
−306
Merged
upgrade: golangci-lint to v2 #22648
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
593372f
fix: golangci-lint issues
sreeram77 e7dda4a
migrate golangci-lint config to v2
sreeram77 b1e76ef
upgrade: golangci-lint to v2.4.0
sreeram77 762f735
fix: lint issue in iptables_executor_linux.go
sreeram77 6fe730b
fix: linter issues
sreeram77 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,124 +1,118 @@ | ||
| # Copyright (c) HashiCorp, Inc. | ||
| # SPDX-License-Identifier: BUSL-1.1 | ||
|
|
||
| version: "2" | ||
| run: | ||
| concurrency: 4 | ||
| linters: | ||
| disable-all: true | ||
| default: none | ||
| enable: | ||
| - gofmt | ||
| - depguard | ||
| - forbidigo | ||
| - gomodguard | ||
| - govet | ||
| - unconvert | ||
| - staticcheck | ||
| - ineffassign | ||
| - staticcheck | ||
| - unconvert | ||
| - unparam | ||
| - forbidigo | ||
| - gomodguard | ||
| - depguard | ||
|
|
||
| issues: | ||
| # Disable the default exclude list so that all excludes are explicitly | ||
| # defined in this file. | ||
| exclude-use-default: false | ||
|
|
||
| exclude-rules: | ||
| # Temp Ignore SA9004: only the first constant in this group has an explicit type | ||
| # https://staticcheck.io/docs/checks#SA9004 | ||
| - linters: [staticcheck] | ||
| text: "SA9004:" | ||
|
|
||
| - linters: [staticcheck] | ||
| text: "SA1006:" | ||
|
|
||
| - linters: [staticcheck] | ||
| text: 'SA1019: "io/ioutil" has been deprecated since Go 1.16' | ||
|
|
||
| # Allow usage of deprecated values. | ||
| - linters: [ staticcheck ] | ||
| text: 'SA1019:' | ||
| path: "(agent/grpc-external|agent/grpc-internal)" | ||
|
|
||
| # An argument that always receives the same value is often not a problem. | ||
| - linters: [unparam] | ||
| text: "always receives" | ||
|
|
||
| - linters: [ unparam ] | ||
| text: 'result \d+ \(bool\) is always false' | ||
|
|
||
| # Often functions will implement an interface that returns an error without | ||
| # needing to return an error. Sometimes the error return value is unnecessary | ||
| # but a linter can not tell the difference. | ||
| - linters: [unparam] | ||
| text: 'result \d+ \(error\) is always nil' | ||
|
|
||
| # Allow unused parameters to start with an underscore. Arguments with a name | ||
| # of '_' are already ignored. | ||
| # Ignoring longer names that start with underscore allow for better | ||
| # self-documentation than a single underscore by itself. Underscore arguments | ||
| # should generally only be used when a function is implementing an interface. | ||
| - linters: [unparam] | ||
| text: "`_[^`]*` is unused" | ||
|
|
||
| # Temp ignore some common unused parameters so that unparam can be added | ||
| # incrementally. | ||
| - linters: [unparam] | ||
| text: "`(t|resp|req|entMeta)` is unused" | ||
|
|
||
| # Temp ignore everything in _ce(_test).go and _ent(_test).go. Many of these | ||
| # could use underscore to ignore the unused arguments, but the "always returns" | ||
| # issue will likely remain in CE, and will need to be excluded. | ||
| - linters: [unparam] | ||
| path: "(_ce.go|_ce_test.go|_ent.go|_ent_test.go)" | ||
|
|
||
| - linters: [ staticcheck ] | ||
| text: 'SA1019:' | ||
|
|
||
| linters-settings: | ||
| govet: | ||
| enable-all: true | ||
| disable: | ||
| - fieldalignment | ||
| - nilness | ||
| - shadow | ||
| - unusedwrite | ||
| - printf | ||
| gofmt: | ||
| simplify: true | ||
| forbidigo: | ||
| # Forbid the following identifiers (list of regexp). | ||
| # Format includes custom message based on https://github.com/ashanbrown/forbidigo/pull/11 | ||
| forbid: | ||
| - '\bhtml\/template\b(# Use text/template instead)?' | ||
| - '\bioutil\b(# Use io and os packages instead of ioutil)?' | ||
| - '\brequire\.New\b(# Use package-level functions with explicit TestingT)?' | ||
| - '\bassert\.New\b(# Use package-level functions with explicit TestingT)?' | ||
| # Exclude godoc examples from forbidigo checks. | ||
| # Default: true | ||
| exclude_godoc_examples: false | ||
| gomodguard: | ||
| blocked: | ||
| # List of blocked modules. | ||
| modules: | ||
| # Blocked module. | ||
| - github.com/hashicorp/net-rpc-msgpackrpc: | ||
| recommendations: | ||
| - github.com/hashicorp/consul-net-rpc/net-rpc-msgpackrpc | ||
| - github.com/hashicorp/go-msgpack: | ||
| recommendations: | ||
| - github.com/hashicorp/consul-net-rpc/go-msgpack | ||
| - github.com/golang/protobuf: | ||
| recommendations: | ||
| - google.golang.org/protobuf | ||
|
|
||
| depguard: | ||
| settings: | ||
| depguard: | ||
| rules: | ||
| main: | ||
| deny: | ||
| - pkg: net/rpc | ||
| desc: only use forked copy in github.com/hashicorp/consul-net-rpc/net/rpc | ||
| - pkg: github.com/golang/protobuf | ||
| desc: only use google.golang.org/protobuf | ||
| forbidigo: | ||
| forbid: | ||
| - pattern: \bhtml\/template\b(# Use text/template instead)? | ||
| - pattern: \bioutil\b(# Use io and os packages instead of ioutil)? | ||
| - pattern: \brequire\.New\b(# Use package-level functions with explicit TestingT)? | ||
| - pattern: \bassert\.New\b(# Use package-level functions with explicit TestingT)? | ||
| gomodguard: | ||
| blocked: | ||
| modules: | ||
| - github.com/hashicorp/net-rpc-msgpackrpc: | ||
| recommendations: | ||
| - github.com/hashicorp/consul-net-rpc/net-rpc-msgpackrpc | ||
| - github.com/hashicorp/go-msgpack: | ||
| recommendations: | ||
| - github.com/hashicorp/consul-net-rpc/go-msgpack | ||
| - github.com/golang/protobuf: | ||
| recommendations: | ||
| - google.golang.org/protobuf | ||
| govet: | ||
| disable: | ||
| - fieldalignment | ||
| - nilness | ||
| - shadow | ||
| - unusedwrite | ||
| - printf | ||
| enable-all: true | ||
| exclusions: | ||
| generated: lax | ||
| rules: | ||
| main: | ||
| listMode: lax | ||
| deny: | ||
| - pkg: net/rpc | ||
| desc: "only use forked copy in github.com/hashicorp/consul-net-rpc/net/rpc" | ||
| - pkg: github.com/golang/protobuf | ||
| desc: "only use google.golang.org/protobuf" | ||
|
|
||
| run: | ||
| timeout: 10m | ||
| concurrency: 4 | ||
| skip-dirs-use-default: false | ||
| - linters: | ||
| - staticcheck | ||
| text: 'SA9004:' | ||
| - linters: | ||
| - staticcheck | ||
| text: 'SA1006:' | ||
| - linters: | ||
| - staticcheck | ||
| text: 'SA1019: "io/ioutil" has been deprecated since Go 1.16' | ||
| - linters: | ||
| - staticcheck | ||
| path: (agent/grpc-external|agent/grpc-internal) | ||
| text: 'SA1019:' | ||
| - linters: | ||
| - unparam | ||
| text: always receives | ||
| - linters: | ||
| - unparam | ||
| text: result \d+ \(bool\) is always false | ||
| - linters: | ||
| - unparam | ||
| text: result \d+ \(error\) is always nil | ||
| - linters: | ||
| - unparam | ||
| text: '`_[^`]*` is unused' | ||
| - linters: | ||
| - unparam | ||
| text: '`(t|resp|req|entMeta)` is unused' | ||
| - linters: | ||
| - unparam | ||
| path: (_ce.go|_ce_test.go|_ent.go|_ent_test.go) | ||
| - linters: | ||
| - staticcheck | ||
| text: 'SA1019:' | ||
| - linters: | ||
| - staticcheck | ||
| text: 'ST1005: error strings should not end with punctuation or newlines' | ||
| - linters: | ||
| - staticcheck | ||
| text: 'ST1012: error var injectedError should have name of the form errFo' | ||
| - linters: | ||
| - staticcheck | ||
| text: 'ST1005: error strings should not be capitalized' | ||
| - linters: | ||
| - staticcheck | ||
| text: 'ST1012: error var' | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
| - agent/consul | ||
| formatters: | ||
| enable: | ||
| - gofmt | ||
| settings: | ||
| gofmt: | ||
| simplify: true | ||
| exclusions: | ||
| generated: lax | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.