From c7e52302e28981242f0f2f5aaeb555bffc2f82ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Mar 2025 01:52:04 +0000 Subject: [PATCH 1/4] Bump golangci/golangci-lint-action from 6 to 7 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v6...v7) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 72463410a..82fb66e29 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -24,7 +24,7 @@ jobs: go-version: ${{ env.DESIRED_GO_VERSION }} - name: golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v7 with: version: ${{ env.DESIRED_GOLANGCI_LINT_VERSION }} From 3cad1e628ce6e58abda48101169e3b89c65a53e4 Mon Sep 17 00:00:00 2001 From: Lisa Rashidi-Ranjbar Date: Fri, 4 Apr 2025 15:06:53 -0700 Subject: [PATCH 2/4] bump version of golangci-lint --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 82fb66e29..0e1702286 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -6,7 +6,7 @@ on: # yamllint disable-line rule:truthy env: DESIRED_GO_VERSION: '1.22' - DESIRED_GOLANGCI_LINT_VERSION: 'v1.60' + DESIRED_GOLANGCI_LINT_VERSION: 'v2.0.2' DESIRED_PYTHON_VERSION: '3.12' jobs: From a887c2cd521e363df9d2c2d95b5ae33d11d36cc7 Mon Sep 17 00:00:00 2001 From: Lisa Rashidi-Ranjbar Date: Fri, 4 Apr 2025 15:27:28 -0700 Subject: [PATCH 3/4] migrate golangci-lint config to v2 --- .golangci.yml | 178 ++++++++++++++++++++++++++------------------------ 1 file changed, 94 insertions(+), 84 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 09764a029..a03e46221 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,26 +1,17 @@ ---- -run: - timeout: 10m - +version: "2" linters: - disable-all: true + default: none enable: - asciicheck - bodyclose - depguard - dogsled - durationcheck - - exportloopref - - gci - gocritic - godot - - gofmt - - gofumpt - goheader - - goimports - gomodguard - gosec - - gosimple - govet - importas - ineffassign @@ -36,82 +27,101 @@ linters: - rowserrcheck - sqlclosecheck - staticcheck - - stylecheck - tparallel - - typecheck - unconvert - unused - wastedassign - whitespace - -linters-settings: - depguard: + settings: + depguard: + rules: + main: + files: + - $all + - '!$test' + - '!**/functional/**/*.go' + allow: + - $gostd + - github.com/ansible/receptor/internal/version + - github.com/ansible/receptor/cmd + - github.com/ansible/receptor/pkg + - github.com/creack/pty + - github.com/fsnotify/fsnotify + - github.com/ghjm/cmdline + - github.com/golang-jwt/jwt/v4 + - github.com/google/shlex + - github.com/gorilla/websocket + - github.com/jupp0r/go-priority-queue + - github.com/minio/highwayhash + - github.com/pbnjay/memory + - github.com/quic-go/quic-go + - github.com/rogpeppe/go-internal/lockedfile + - github.com/songgao/water + - github.com/vishvananda/netlink + - github.com/spf13/viper + - github.com/spf13/cobra + - k8s.io/api/core + - k8s.io/apimachinery/pkg + - k8s.io/client-go + - github.com/grafana/pyroscope-go + - github.com/sirupsen/logrus + tests: + files: + - $test + - '**/functional/**/*.go' + allow: + - $gostd + - github.com/ansible/receptor/pkg + - github.com/ansible/receptor/tests/utils + - github.com/fortytw2/leaktest + - github.com/fsnotify/fsnotify + - github.com/gorilla/websocket + - github.com/prep/socketpair + - github.com/google/go-cmp/cmp + - k8s.io/api/core/v1 + - k8s.io/apimachinery/pkg/api/errors + - k8s.io/apimachinery/pkg/apis/meta/v1 + - k8s.io/apimachinery/pkg/fields + - k8s.io/apimachinery/pkg/selection + - k8s.io/apimachinery/pkg/watch + - k8s.io/client-go/kubernetes + - k8s.io/client-go/rest + - k8s.io/client-go/tools/remotecommand + - github.com/quic-go/quic-go + - github.com/quic-go/quic-go/logging + - github.com/AaronH88/quic-go + - github.com/stretchr/testify/assert + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling rules: - main: - files: - - "$all" - - "!$test" - - "!**/functional/**/*.go" - allow: - - "$gostd" - - "github.com/ansible/receptor/internal/version" - - "github.com/ansible/receptor/cmd" - - "github.com/ansible/receptor/pkg" - - "github.com/creack/pty" - - "github.com/fsnotify/fsnotify" - - "github.com/ghjm/cmdline" - - "github.com/golang-jwt/jwt/v4" - - "github.com/google/shlex" - - "github.com/gorilla/websocket" - - "github.com/jupp0r/go-priority-queue" - - "github.com/minio/highwayhash" - - "github.com/pbnjay/memory" - - "github.com/quic-go/quic-go" - - "github.com/rogpeppe/go-internal/lockedfile" - - "github.com/songgao/water" - - "github.com/vishvananda/netlink" - - "github.com/spf13/viper" - - "github.com/spf13/cobra" - - "k8s.io/api/core" - - "k8s.io/apimachinery/pkg" - - "k8s.io/client-go" - - "github.com/grafana/pyroscope-go" - - "github.com/sirupsen/logrus" - tests: - files: - - "$test" - - "**/functional/**/*.go" - allow: - - "$gostd" - - "github.com/ansible/receptor/pkg" - - "github.com/ansible/receptor/tests/utils" - - "github.com/fortytw2/leaktest" - - "github.com/fsnotify/fsnotify" - - "github.com/gorilla/websocket" - - "github.com/prep/socketpair" - - "github.com/google/go-cmp/cmp" - - "k8s.io/api/core/v1" - - "k8s.io/apimachinery/pkg/api/errors" - - "k8s.io/apimachinery/pkg/apis/meta/v1" - - "k8s.io/apimachinery/pkg/fields" - - "k8s.io/apimachinery/pkg/selection" - - "k8s.io/apimachinery/pkg/watch" - - "k8s.io/client-go/kubernetes" - - "k8s.io/client-go/rest" - - "k8s.io/client-go/tools/remotecommand" - - "github.com/quic-go/quic-go" - - "github.com/quic-go/quic-go/logging" - - "github.com/AaronH88/quic-go" - - "github.com/stretchr/testify/assert" - -issues: - # Dont commit the following line. - # It will make CI pass without telling you about errors. - # fix: true - exclude: - - "lostcancel" # TODO: Context is not canceled on multiple occasions. Needs more detailed work to be fixed. - - "SA2002|thelper|testinggoroutine" # TODO: Test interface used outside of its routine, tests need to be rewritten. - - "G306" # TODO: Restrict perms of touched files. - - "G402|G404" # TODO: Make TLS more secure. - - "G204" # gosec is throwing a fit, ignore. -... + - path: (.+)\.go$ + text: lostcancel + - path: (.+)\.go$ + text: SA2002|thelper|testinggoroutine + - path: (.+)\.go$ + text: G306 + - path: (.+)\.go$ + text: G402|G404 + - path: (.+)\.go$ + text: G204 + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gci + - gofmt + - gofumpt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ From b01c228f5680d4dbad82d95d88d7716adfb128e9 Mon Sep 17 00:00:00 2001 From: Lisa Rashidi-Ranjbar Date: Fri, 4 Apr 2025 15:34:33 -0700 Subject: [PATCH 4/4] update depgaurd allow lists --- .golangci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index a03e46221..827ca0be1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -65,6 +65,10 @@ linters: - k8s.io/client-go - github.com/grafana/pyroscope-go - github.com/sirupsen/logrus + - gopkg.in/yaml.v2 + - golang.org/x/net/ipv4 + - golang.org/x/net/ipv6 + - go.uber.org/goleak tests: files: - $test @@ -91,6 +95,8 @@ linters: - github.com/quic-go/quic-go/logging - github.com/AaronH88/quic-go - github.com/stretchr/testify/assert + - go.uber.org/mock/gomock + - golang.org/x/sys/unix exclusions: generated: lax presets: