-
Notifications
You must be signed in to change notification settings - Fork 597
/
.golangci.yaml
126 lines (106 loc) · 3.45 KB
/
.golangci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# https://golangci-lint.run/usage/configuration/
linters:
disable:
- contextcheck
- gci
- gofumpt
enable:
- depguard
- goheader
- gomodguard
- gosimple
- importas
- misspell
- unconvert
presets:
- bugs
- format
- unused
linters-settings:
depguard:
rules:
everything:
list-mode: lax
allow:
- go.opentelemetry.io/otel/semconv/v1.27.0
deny:
- pkg: go.opentelemetry.io/otel/semconv
desc: Use "go.opentelemetry.io/otel/semconv/v1.27.0" instead.
- pkg: io/ioutil
desc: >
Use the "io" and "os" packages instead.
See https://go.dev/doc/go1.16#ioutil
not-tests:
files: ['!$test']
deny:
- pkg: net/http/httptest
desc: Should be used only in tests.
- pkg: testing/*
desc: The "testing" packages should be used only in tests.
- pkg: github.com/crunchydata/postgres-operator/internal/testing/*
desc: The "internal/testing" packages should be used only in tests.
- pkg: k8s.io/client-go/discovery
desc: Use the "internal/kubernetes" package instead.
tests:
files: ['$test']
deny:
- pkg: github.com/pkg/errors
desc: Use the "errors" package unless you are interacting with stack traces.
errchkjson:
check-error-free-encoding: true
exhaustive:
default-signifies-exhaustive: true
goheader:
template: |-
Copyright {{ DATES }} Crunchy Data Solutions, Inc.
SPDX-License-Identifier: Apache-2.0
values:
regexp:
DATES: '((201[7-9]|202[0-3]) - 2024|2024)'
goimports:
local-prefixes: github.com/crunchydata/postgres-operator
gomodguard:
blocked:
modules:
- gopkg.in/yaml.v2: { recommendations: [sigs.k8s.io/yaml] }
- gopkg.in/yaml.v3: { recommendations: [sigs.k8s.io/yaml] }
- gotest.tools: { recommendations: [gotest.tools/v3] }
- k8s.io/kubernetes:
reason: >
k8s.io/kubernetes is for managing dependencies of the Kubernetes
project, i.e. building kubelet and kubeadm.
gosec:
excludes:
# Flags for potentially-unsafe casting of ints, similar problem to globally-disabled G103
- G115
importas:
alias:
- pkg: k8s.io/api/(\w+)/(v[\w\w]+)
alias: $1$2
- pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+)
alias: $1$2
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: apierrors
no-unaliased: true
spancheck:
checks: [end, record-error]
extra-start-span-signatures:
- 'github.com/crunchydata/postgres-operator/internal/tracing.Start:opentelemetry'
ignore-check-signatures:
- 'tracing.Escape'
issues:
exclude-generated: strict
exclude-rules:
# This internal package is the one place we want to do API discovery.
- linters: [depguard]
path: internal/kubernetes/discovery.go
text: k8s.io/client-go/discovery
# PGO-2010
- linters: [exhaustive]
path: internal/controller/postgrescluster/volumes.go
text: 'v1.PersistentVolumeClaimConditionType: v1.PersistentVolumeClaimControllerResizeError, v1.PersistentVolumeClaimNodeResizeError$'
# These value types have unmarshal methods.
# https://github.com/raeperd/recvcheck/issues/7
- linters: [recvcheck]
path: internal/pki/pki.go
text: 'methods of "(Certificate|PrivateKey)"'