diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6833e1f4..23cb8f0c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,9 +20,9 @@ jobs: - uses: ibiqlik/action-yamllint@v3 with: format: auto - - uses: golangci/golangci-lint-action@v6 + - uses: golangci/golangci-lint-action@v7 with: - version: v1.61.0 + version: v2.0.2 args: -v verify-vendor: name: Verify vendor directory diff --git a/.golangci.yml b/.golangci.yml index 82e41c11..ebc81947 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,53 +1,71 @@ -issues: - exclude-rules: - - linters: - - revive - text: "don't use ALL_CAPS in Go names; use CamelCase" - - linters: - - revive - text: " and that stutters;" - - path: '(.+)_test\.go' - text: "dot-imports: should not use dot imports" - +version: "2" +run: + modules-download-mode: vendor linters: - disable: - - errcheck enable: - contextcheck - durationcheck - forbidigo - - gci - ginkgolinter - gocritic - - gofumpt - - gosimple - - govet - - ineffassign - misspell - nonamedreturns - predeclared - revive - - staticcheck - unconvert - unparam - - unused - wastedassign - -linters-settings: - gci: - sections: - - standard - - default - - prefix(github.com/containernetworking) - - forbidigo: - forbid: - # Copied from https://github.com/moby/moby/pull/48407 - - pkg: ^github.com/vishvananda/netlink$ - p: ^netlink\.(Handle\.)?(AddrList|BridgeVlanList|ChainList|ClassList|ConntrackTableList|ConntrackDeleteFilter$|ConntrackDeleteFilters|DevLinkGetDeviceList|DevLinkGetAllPortList|DevlinkGetDeviceParams|FilterList|FouList|GenlFamilyList|GTPPDPList|LinkByName|LinkByAlias|LinkList|LinkSubscribeWithOptions|NeighList$|NeighProxyList|NeighListExecute|NeighSubscribeWithOptions|LinkGetProtinfo|QdiscList|RdmaLinkList|RdmaLinkByName|RdmaLinkDel|RouteList|RouteListFilteredIter|RuleListFiltered$|RouteSubscribeWithOptions|RuleList$|RuleListFiltered|SocketGet|SocketDiagTCPInfo|SocketDiagTCP|SocketDiagUDPInfo|SocketDiagUDP|UnixSocketDiagInfo|UnixSocketDiag|VDPAGetDevConfigList|VDPAGetDevList|VDPAGetMGMTDevList|XfrmPolicyList|XfrmStateList) - msg: Use internal netlinksafe package for EINTR handling. - analyze-types: true - -run: - timeout: 5m - modules-download-mode: vendor + disable: + - errcheck + settings: + forbidigo: + forbid: + # Copied from https://github.com/moby/moby/pull/48407 + - pattern: ^netlink\.(Handle\.)?(AddrList|BridgeVlanList|ChainList|ClassList|ConntrackTableList|ConntrackDeleteFilter$|ConntrackDeleteFilters|DevLinkGetDeviceList|DevLinkGetAllPortList|DevlinkGetDeviceParams|FilterList|FouList|GenlFamilyList|GTPPDPList|LinkByName|LinkByAlias|LinkList|LinkSubscribeWithOptions|NeighList$|NeighProxyList|NeighListExecute|NeighSubscribeWithOptions|LinkGetProtinfo|QdiscList|RdmaLinkList|RdmaLinkByName|RdmaLinkDel|RouteList|RouteListFilteredIter|RuleListFiltered$|RouteSubscribeWithOptions|RuleList$|RuleListFiltered|SocketGet|SocketDiagTCPInfo|SocketDiagTCP|SocketDiagUDPInfo|SocketDiagUDP|UnixSocketDiagInfo|UnixSocketDiag|VDPAGetDevConfigList|VDPAGetDevList|VDPAGetMGMTDevList|XfrmPolicyList|XfrmStateList) + pkg: ^github.com/vishvananda/netlink$ + msg: Use internal netlinksafe package for EINTR handling. + analyze-types: true + staticcheck: + checks: + - all + - '-QF1008' # nested struct reference + - '-ST1005' # capitalized error strings + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - revive + - staticcheck + text: use ALL_CAPS in Go names; use CamelCase + - linters: + - revive + text: ' and that stutters;' + - path: (.+)_test\.go + text: 'dot-imports: should not use dot imports' + - path: (.+)_test\.go + text: "ginkgo-linter: wrong comparison assertion. Consider using (.+)BeZero(.+)" + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gci + - gofumpt + settings: + gci: + sections: + - standard + - default + - prefix(github.com/containernetworking) + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$