diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 68eb028ebf..343b2aa928 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -16,7 +16,9 @@ jobs: - uses: golangci/golangci-lint-action@v9 with: - version: latest + # Pin so a golangci-lint / staticcheck release cannot change SA1019 + # wording and break exclusion regexes on every pull request. + version: v2.15.0 args: --timeout=5m # Count issues reported by disabled linters. The command always diff --git a/.golangci.yaml b/.golangci.yaml index fb5e7162bb..a5f6a9d2b1 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -171,8 +171,17 @@ linters: path: internal/pki/pki.go text: methods of "(Certificate|PrivateKey)" + # json.Marshaler must stay on the value receiver so encoding/json uses it + # for non-addressable Duration values. Pointer UnmarshalJSON/AsDuration + # are required by json.Unmarshaler and the API. + - linters: [recvcheck] + path: pkg/apis/postgres-operator.crunchydata.com/.*/shared_types\.go + text: methods of "Duration" + + # Newer staticcheck names a deprecated symbol by import path; older + # versions used the alias in the offending file. Match either spelling. - linters: [staticcheck] - text: corev1.(Endpoints|EndpointSubset) is deprecated + text: (corev1|k8s\.io/api/core/v1)\.(Endpoints|EndpointSubset) is deprecated - linters: [staticcheck] path: internal/controller/ @@ -196,11 +205,11 @@ linters: path: pkg/apis/postgres-operator.crunchydata.com/.*/groupversion_info\.go text: scheme.Builder is deprecated - # k8s.io/apimachinery 0.36 deprecated direct access to managed.FieldsV1.Raw + # k8s.io/apimachinery 0.36 deprecated direct access to FieldsV1.Raw # in favor of GetRawBytes/SetRawBytes. Tests still use the old field. - linters: [staticcheck] path: internal/controller/runtime/apply_test\.go - text: managed.FieldsV1.Raw is deprecated + text: (managed\.FieldsV1|\(k8s\.io/apimachinery/pkg/apis/meta/v1\.FieldsV1\))\.Raw is deprecated # https://golangci-lint.run/usage/formatters formatters: