Skip to content

Commit f4ea60a

Browse files
committed
Update golangci-lint config to version 2
Signed-off-by: Cody Soyland <[email protected]>
1 parent b847383 commit f4ea60a

File tree

4 files changed

+42
-31
lines changed

4 files changed

+42
-31
lines changed

.golangci.yml

+38-27
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,57 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
15+
version: "2"
16+
run:
17+
issues-exit-code: 1
1618
linters:
1719
enable:
1820
- asciicheck
19-
- errcheck
2021
- errorlint
21-
- gofmt
22-
- goimports
23-
- gosec
2422
- gocritic
23+
- gosec
2524
- importas
25+
- misspell
2626
- prealloc
2727
- revive
28-
- misspell
29-
- stylecheck
28+
- staticcheck
3029
- tparallel
3130
- unconvert
3231
- unparam
3332
- whitespace
34-
linters-settings:
35-
revive:
33+
settings:
34+
revive:
35+
rules:
36+
- name: dot-imports
37+
arguments:
38+
- allowedPackages:
39+
- knative.dev/pkg/configmap/testing
40+
- knative.dev/pkg/reconciler/testing
41+
- github.com/sigstore/policy-controller/pkg/reconciler/testing/v1alpha1
42+
exclusions:
43+
generated: lax
44+
presets:
45+
- comments
46+
- common-false-positives
47+
- legacy
48+
- std-error-handling
3649
rules:
37-
- name: dot-imports
38-
arguments:
39-
- allowedPackages:
40-
- "knative.dev/pkg/configmap/testing"
41-
- "knative.dev/pkg/reconciler/testing"
42-
- "github.com/sigstore/policy-controller/pkg/reconciler/testing/v1alpha1"
43-
output:
44-
uniq-by-line: false
50+
- linters:
51+
- errcheck
52+
- gosec
53+
path: _test\.go
54+
paths:
55+
- ^third_party/
56+
- ^examples/
4557
issues:
46-
exclude-rules:
47-
- path: _test\.go
48-
linters:
49-
- errcheck
50-
- gosec
5158
max-issues-per-linter: 0
5259
max-same-issues: 0
53-
run:
54-
issues-exit-code: 1
55-
timeout: 10m
56-
skip-dirs:
57-
- third_party
60+
formatters:
61+
enable:
62+
- gofmt
63+
- goimports
64+
exclusions:
65+
generated: lax
66+
paths:
67+
- ^third_party/
68+
- ^examples/

pkg/reconciler/testing/v1alpha1/clusterimagepolicy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func WithResourceVersion(resourceVersion string) ClusterImagePolicyOption {
5757

5858
func WithClusterImagePolicyDeletionTimestamp(cip *v1alpha1.ClusterImagePolicy) {
5959
t := metav1.NewTime(time.Unix(1e9, 0))
60-
cip.ObjectMeta.SetDeletionTimestamp(&t)
60+
cip.SetDeletionTimestamp(&t)
6161
}
6262

6363
func WithImagePattern(ip v1alpha1.ImagePattern) ClusterImagePolicyOption {

pkg/reconciler/testing/v1alpha1/trustroot.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func WithTrustRootResourceVersion(resourceVersion string) TrustRootOption {
5858

5959
func WithTrustRootDeletionTimestamp(tr *v1alpha1.TrustRoot) {
6060
t := metav1.NewTime(time.Unix(1e9, 0))
61-
tr.ObjectMeta.SetDeletionTimestamp(&t)
61+
tr.SetDeletionTimestamp(&t)
6262
}
6363

6464
func WithTrustRootFinalizer(tr *v1alpha1.TrustRoot) {

pkg/webhook/validator.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (v *Validator) ValidatePodScalable(ctx context.Context, ps *policyduckv1bet
152152

153153
// If we are being scaled down don't block it.
154154
if ps.IsScalingDown(ctx) {
155-
logging.FromContext(ctx).Debugf("Skipping validations due to scale down request %s/%s", &ps.ObjectMeta.Name, &ps.ObjectMeta.Namespace)
155+
logging.FromContext(ctx).Debugf("Skipping validations due to scale down request %s/%s", &ps.Name, &ps.Namespace)
156156
return nil
157157
}
158158

@@ -974,7 +974,7 @@ func (v *Validator) ResolvePodScalable(ctx context.Context, ps *policyduckv1beta
974974
}
975975

976976
if ps.IsScalingDown(ctx) {
977-
logging.FromContext(ctx).Debugf("Skipping validations due to scale down request %s/%s", &ps.ObjectMeta.Name, &ps.ObjectMeta.Namespace)
977+
logging.FromContext(ctx).Debugf("Skipping validations due to scale down request %s/%s", &ps.Name, &ps.Namespace)
978978
return
979979
}
980980

0 commit comments

Comments
 (0)