Skip to content

Commit ffe6219

Browse files
authored
Merge pull request #8203 from jklaw90/julian/golangci-lint-v2
chore: bump golangci lint to v2
2 parents 5b25b56 + 504a985 commit ffe6219

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+166
-197
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
GO111MODULE: auto
4545

4646
- name: golangci-lint - vertical-pod-autoscaler
47-
uses: golangci/golangci-lint-action@v6
47+
uses: golangci/golangci-lint-action@v8
4848
with:
4949
args: --timeout=30m
5050
working-directory: ${{ env.GOPATH }}/src/k8s.io/autoscaler/vertical-pod-autoscaler
Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1+
version: "2"
12
linters:
23
enable:
34
- forbidigo
5+
settings:
6+
forbidigo:
7+
forbid:
8+
# Forbid use of archived package "github.com/pkg/errors". Context: https://github.com/kubernetes/autoscaler/pull/7845
9+
- pkg: github.com/pkg/errors
10+
analyze-types: true
11+
formatters:
12+
enable:
413
- goimports
5-
6-
linters-settings:
7-
forbidigo:
8-
forbid:
9-
# Forbid use of archived package "github.com/pkg/errors". Context: https://github.com/kubernetes/autoscaler/pull/7845
10-
- pkg: github.com/pkg/errors
11-
analyze-types: true
12-
13-
goimports:
14-
local-prefixes: "k8s.io/autoscaler/vertical-pod-autoscaler"
14+
- gci
15+
settings:
16+
goimports:
17+
local-prefixes:
18+
- k8s.io/autoscaler/vertical-pod-autoscaler
19+
gci:
20+
sections:
21+
- standard
22+
- default
23+
- prefix(k8s.io/autoscaler/vertical-pod-autoscaler)
24+
- dot
25+
- blank
26+
custom-order: true

vertical-pod-autoscaler/pkg/admission-controller/certs.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ import (
2424
"os"
2525
"sync"
2626

27+
"github.com/fsnotify/fsnotify"
2728
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2829
"k8s.io/apimachinery/pkg/types"
29-
30-
"github.com/fsnotify/fsnotify"
3130
admissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
3231
"k8s.io/klog/v2"
3332
)
@@ -76,7 +75,7 @@ func (cr *certReloader) start(stop <-chan struct{}) error {
7675
}
7776

7877
go func() {
79-
defer watcher.Close()
78+
defer watcher.Close() // nolint:errcheck
8079
for {
8180
select {
8281
case event := <-watcher.Events:

vertical-pod-autoscaler/pkg/admission-controller/certs_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535

3636
"github.com/stretchr/testify/assert"
3737
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
38-
3938
"k8s.io/apimachinery/pkg/runtime"
4039
"k8s.io/client-go/kubernetes/fake"
4140
k8stesting "k8s.io/client-go/testing"
@@ -260,10 +259,8 @@ func TestChangedCAReloader(t *testing.T) {
260259
}
261260

262261
oldCAEncodedString := base64.StdEncoding.EncodeToString(oldWebhookCABundle)
263-
for {
264-
if patchCalled.Load() {
265-
break
266-
}
262+
for !patchCalled.Load() {
263+
267264
time.Sleep(1 * time.Second)
268265
}
269266
newWebhookConfig, err := webhookConfigInterface.Get(context.TODO(), webhookConfigName, metav1.GetOptions{})

vertical-pod-autoscaler/pkg/admission-controller/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func configTLS(cfg certsConfig, minTlsVersion, ciphers string, stop <-chan struc
6262
case "tls1_3":
6363
tlsVersion = tls.VersionTLS13
6464
default:
65-
klog.Fatal(fmt.Errorf("Unable to determine value for --min-tls-version (%s), must be either tls1_2 or tls1_3", minTlsVersion))
65+
klog.Fatal(fmt.Errorf("unable to determine value for --min-tls-version (%s), must be either tls1_2 or tls1_3", minTlsVersion))
6666
}
6767

6868
config := &tls.Config{

vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/observed_containers_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ import (
2020
"strings"
2121
"testing"
2222

23+
"github.com/stretchr/testify/assert"
2324
core "k8s.io/api/core/v1"
2425

2526
resource_admission "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/admission-controller/resource"
2627
"k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/annotations"
2728
"k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/test"
28-
29-
"github.com/stretchr/testify/assert"
3029
)
3130

3231
func addVpaObservedContainersPatch(containerNames []string) resource_admission.PatchRecord {

vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/resource_updates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (c *resourcesUpdatesPatchCalculator) CalculatePatches(pod *core.Pod, vpa *v
5656

5757
containersResources, annotationsPerContainer, err := c.recommendationProvider.GetContainersResourcesForPod(pod, vpa)
5858
if err != nil {
59-
return []resource_admission.PatchRecord{}, fmt.Errorf("Failed to calculate resource patch for pod %s/%s: %v", pod.Namespace, pod.Name, err)
59+
return []resource_admission.PatchRecord{}, fmt.Errorf("failed to calculate resource patch for pod %s/%s: %v", pod.Namespace, pod.Name, err)
6060
}
6161

6262
if annotationsPerContainer == nil {

vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/resource_updates_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ import (
2121
"strings"
2222
"testing"
2323

24+
"github.com/stretchr/testify/assert"
2425
core "k8s.io/api/core/v1"
2526
"k8s.io/apimachinery/pkg/api/resource"
2627

2728
resource_admission "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/admission-controller/resource"
2829
vpa_types "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
2930
"k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/test"
3031
vpa_api_util "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/vpa"
31-
32-
"github.com/stretchr/testify/assert"
3332
)
3433

3534
const (

vertical-pod-autoscaler/pkg/admission-controller/resource/pod/patch/test_util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import (
2121
"fmt"
2222
"testing"
2323

24-
resource_admission "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/admission-controller/resource"
25-
2624
"github.com/stretchr/testify/assert"
25+
26+
resource_admission "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/admission-controller/resource"
2727
)
2828

2929
// EqPatch returns true if patches are equal by comparing their

vertical-pod-autoscaler/pkg/admission-controller/resource/pod/recommendation/recommendation_provider_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ import (
2121
"math"
2222
"testing"
2323

24+
"github.com/stretchr/testify/assert"
2425
apiv1 "k8s.io/api/core/v1"
2526
"k8s.io/apimachinery/pkg/api/resource"
2627

2728
vpa_types "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
2829
"k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/limitrange"
2930
"k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/test"
3031
vpa_api_util "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/vpa"
31-
32-
"github.com/stretchr/testify/assert"
3332
)
3433

3534
func mustParseResourcePointer(val string) *resource.Quantity {

0 commit comments

Comments
 (0)