formatters: enable: - gofumpt - goimports settings: goimports: local-prefixes: - github.com/hanzoai/cd issues: max-issues-per-linter: 0 max-same-issues: 0 linters: enable: - errorlint - exptostd - gocritic - gomodguard_v2 - govet - importas - misspell - modernize - noctx - perfsprint - revive - staticcheck - testifylint - thelper - tparallel - unparam - usestdlibvars - usetesting - whitespace exclusions: rules: - linters: - unparam path: (.+)_test\.go presets: - comments - common-false-positives - legacy - std-error-handling warn-unused: true settings: gocritic: enable-all: true # Most of these should probably be enabled one-by-one. disabled-checks: - appendAssign - appendCombine # Leave disabled, multi-line assigns can be more readable. - assignOp # Leave disabled, assign operations can be more confusing than helpful. - commentedOutCode - deferInLoop - exitAfterDefer - hugeParam - importShadow - paramTypeCombine # Leave disabled, there are too many failures to be worth fixing. - rangeValCopy - tooManyResultsChecker - unnamedResult - whyNoLint gomodguard_v2: blocked: - module: github.com/golang-jwt/jwt/v4 recommendations: - github.com/golang-jwt/jwt/v5 - module: github.com/imdario/mergo recommendations: - dario.cat/mergo reason: '`github.com/imdario/mergo` has been renamed.' - module: github.com/pkg/errors recommendations: - errors govet: disable: - fieldalignment - shadow enable-all: true importas: alias: - pkg: github.com/golang-jwt/jwt/v5 alias: jwtgo - pkg: k8s.io/api/apps/v1 alias: appsv1 - pkg: k8s.io/api/core/v1 alias: corev1 - pkg: k8s.io/api/rbac/v1 alias: rbacv1 - pkg: k8s.io/apimachinery/pkg/api/errors alias: apierrors - pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 alias: apiextensionsv1 - pkg: k8s.io/apimachinery/pkg/apis/meta/v1 alias: metav1 - pkg: k8s.io/client-go/informers/core/v1 alias: informersv1 - pkg: errors alias: stderrors - pkg: github.com/hanzoai/cd/util/io alias: utilio modernize: disable: # Suggest replacing omitempty with omitzero for struct fields. - omitzero # Simplify code by using go1.26's new(expr). - generates lots of false positives. - newexpr nolintlint: require-specific: true perfsprint: # Optimizes even if it requires an int or uint type cast. int-conversion: true # Optimizes into `err.Error()` even if it is only equivalent for non-nil errors. err-error: true # Optimizes `fmt.Errorf`. errorf: true # Optimizes `fmt.Sprintf` with only one argument. sprintf1: true # Optimizes into strings concatenation. strconcat: true revive: enable-all-rules: false enable-default-rules: true max-open-files: 2048 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md rules: - name: blank-imports disabled: true - name: bool-literal-in-expr - name: context-as-argument arguments: - allow-types-before: '*testing.T,testing.TB' - name: context-keys-type disabled: true - name: dot-imports disabled: true - name: duplicated-imports - name: early-return arguments: - preserve-scope - name: empty-block disabled: true - name: error-return - name: error-strings disabled: true - name: errorf - name: exported disabled: true - name: identical-branches - name: if-return - name: increment-decrement - name: indent-error-flow arguments: - preserve-scope - name: modifies-parameter - name: optimize-operands-order - name: range - name: receiver-naming - name: redefines-builtin-id disabled: true - name: redundant-import-alias - name: superfluous-else arguments: - preserve-scope - name: time-equal - name: time-naming disabled: true - name: unexported-return disabled: true - name: unnecessary-format - name: unnecessary-stmt - name: unreachable-code - name: unused-parameter - name: use-any - name: useless-break - name: var-declaration - name: var-naming arguments: - - ID - - VM - - skip-initialism-name-checks: true upper-case-const: true staticcheck: checks: - all - -SA5011 - -ST1003 - -ST1016 testifylint: enable-all: true disable: - go-require unused: field-writes-are-uses: false exported-fields-are-used: false usetesting: os-mkdir-temp: false version: "2"