Skip to content

Commit c4dcb43

Browse files
authored
Merge pull request #3688 from xrstf/go125-lint-compat
Bump golangci-lint to 2.6.0
2 parents d9a5e10 + 52db8f2 commit c4dcb43

12 files changed

Lines changed: 148 additions & 29 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ YAML_PATCH_BIN := yaml-patch
5151
YAML_PATCH := $(TOOLS_DIR)/$(YAML_PATCH_BIN)-$(YAML_PATCH_VER)
5252
export YAML_PATCH # so hack scripts can use it
5353

54-
GOLANGCI_LINT_VER := 2.1.6
54+
GOLANGCI_LINT_VER := 2.6.0
5555
GOLANGCI_LINT_BIN := golangci-lint
5656
GOLANGCI_LINT := $(TOOLS_GOBIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
5757
GOLANGCI_LINT_FLAGS ?=

hack/tools.checksums

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
controller-gen|GOARCH=amd64;GOOS=linux|21e5f3239666fc0c5e2d23c2a3a83fd655af40a969ede7a118b86832c35a829f
22
controller-gen|GOARCH=arm64;GOOS=darwin|2ca28be7185d9279ed82e3355529b0543938f392cb812add3f25a62196ed7441
33
controller-gen|GOARCH=arm64;GOOS=linux|a1a1f758435d05933c4b2f8c292f8ab2448e81a02c45f14dbd81c10e87ec4b20
4-
golangci-lint|GOARCH=amd64;GOOS=linux|7009324a8aad93c1f84dce1c3cf61181bdd6b68e5f1b8b5d6971662258255050
5-
golangci-lint|GOARCH=arm64;GOOS=darwin|96dc1dbbb686fc7982b9ea4b800f3d234a2d9fb78b0344f287e8d28ee11bc72b
6-
golangci-lint|GOARCH=arm64;GOOS=linux|c51ff5b21be688b043baea44de7dd855cf07b855c14f0de405bfaf922b1d7634
4+
golangci-lint|GOARCH=amd64;GOOS=linux|f0cdf40b6c161524898d79cad40fa92d7fde7d4a5ecfa07360937160cb61fb2b
5+
golangci-lint|GOARCH=arm64;GOOS=darwin|2a2c09731f02f890aec506c2558c5eb67613aaf268806aa66956ee63858647fb
6+
golangci-lint|GOARCH=arm64;GOOS=linux|be2ea9fc5ecf9a64b7d1291a3b62694edbff3b3d29fe566a3e43ef2e89d4556d
77
gotestsum|GOARCH=amd64;GOOS=linux|2e505a9368568aa7422e0a90ef77acc8807c0d3272ab81c7a69e3e8688d1cf65
88
gotestsum|GOARCH=arm64;GOOS=darwin|020be8d14358c7ac4155e296436057cf4b1f1232f8f8f3d71f22a0e7a5504340
99
gotestsum|GOARCH=arm64;GOOS=linux|2f8517768c2831750cb372e379404a059dbd20f2b1f79bcc235c4cab4540cb10

pkg/network/dialer_linux.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build linux
2-
// +build linux
32

43
/*
54
Copyright 2024 The KCP Authors.

pkg/network/dialer_other.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build !linux
2-
// +build !linux
32

43
/*
54
Copyright 2024 The KCP Authors.

staging/src/github.com/kcp-dev/sdk/apis/apis/v1alpha1/types_apiexportendpointslice.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ const (
116116
PartitionValid conditionsv1alpha1.ConditionType = "PartitionValid"
117117

118118
// EndpointURLsReady is a condition for APIExportEndpointSlice that reflects the readiness of the URLs.
119+
//
119120
// Deprecated: This condition is deprecated and will be removed in a future release.
120121
APIExportEndpointSliceURLsReady conditionsv1alpha1.ConditionType = "EndpointURLsReady"
121122

staging/src/github.com/kcp-dev/sdk/apis/cache/v1alpha1/types_cachedresourceendpointslice.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const (
110110
PartitionValid conditionsv1alpha1.ConditionType = "PartitionValid"
111111

112112
// EndpointURLsReady is a condition for CachedResourceEndpointSlice that reflects the readiness of the URLs.
113+
//
113114
// Deprecated: This condition is deprecated and will be removed in a future release.
114115
CachedResourceEndpointSliceURLsReady conditionsv1alpha1.ConditionType = "EndpointURLsReady"
115116

staging/src/github.com/kcp-dev/sdk/testing/server/fixture.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const kcpBinariesDirEnvDir = "KCP_BINARIES_DIR"
5858

5959
// RunInProcessFunc instantiates the kcp server in process for easier debugging.
6060
// It is here to decouple the rest of the code from kcp core dependencies.
61+
//
6162
// Deprecated: Use ContextRunInProcessFunc instead.
6263
var RunInProcessFunc func(t TestingT, dataDir string, args []string) (<-chan struct{}, error)
6364

test/e2e/conformance/cross_logical_cluster_list_test.go

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package conformance
1919
import (
2020
"context"
2121
"fmt"
22+
"strings"
2223
"testing"
2324
"time"
2425

@@ -27,6 +28,7 @@ import (
2728
corev1 "k8s.io/api/core/v1"
2829
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2930
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
31+
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3032
"k8s.io/apimachinery/pkg/labels"
3133
"k8s.io/apimachinery/pkg/runtime"
3234
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -45,6 +47,7 @@ import (
4547
tenancyv1alpha1 "github.com/kcp-dev/sdk/apis/tenancy/v1alpha1"
4648
kcpclientset "github.com/kcp-dev/sdk/client/clientset/versioned/cluster"
4749
kcptesting "github.com/kcp-dev/sdk/testing"
50+
kcptestinghelpers "github.com/kcp-dev/sdk/testing/helpers"
4851

4952
configcrds "github.com/kcp-dev/kcp/config/crds"
5053
"github.com/kcp-dev/kcp/pkg/informer"
@@ -196,20 +199,20 @@ func TestCRDCrossLogicalClusterListPartialObjectMetadata(t *testing.T) {
196199
t.Logf("Install a different sheriffs CRD into workspace %q", wsNormalCRD2)
197200
bootstrapCRD(t, wsNormalCRD2, crdClusterClient.ApiextensionsV1().CustomResourceDefinitions(), sheriffCRD2)
198201

199-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, wsNormalCRD1a, group, wsNormalCRD1a.String())
200-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, wsNormalCRD1b, group, wsNormalCRD1b.String())
202+
createSheriff(ctx, t, dynamicClusterClient, wsNormalCRD1a, group)
203+
createSheriff(ctx, t, dynamicClusterClient, wsNormalCRD1b, group)
201204

202205
apifixtures.CreateSheriffsSchemaAndExport(ctx, t, wsExport1a, kcpClusterClient, group, "export1")
203206
apifixtures.BindToExport(ctx, t, wsExport1a, group, wsConsume1a, kcpClusterClient)
204-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, wsConsume1a, group, wsConsume1a.String())
207+
createSheriff(ctx, t, dynamicClusterClient, wsConsume1a, group)
205208

206209
apifixtures.CreateSheriffsSchemaAndExport(ctx, t, wsExport1b, kcpClusterClient, group, "export1")
207210
apifixtures.BindToExport(ctx, t, wsExport1b, group, wsConsume1b, kcpClusterClient)
208-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, wsConsume1b, group, wsConsume1b.String())
211+
createSheriff(ctx, t, dynamicClusterClient, wsConsume1b, group)
209212

210213
apifixtures.CreateSheriffsSchemaAndExport(ctx, t, wsExport2, kcpClusterClient, group, "export2")
211214
apifixtures.BindToExport(ctx, t, wsExport2, group, wsConsume2, kcpClusterClient)
212-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, wsConsume2, group, wsConsume2.String())
215+
createSheriff(ctx, t, dynamicClusterClient, wsConsume2, group)
213216

214217
t.Logf("Trying to wildcard list with PartialObjectMetadata content-type and it should work")
215218
rootShardMetadataClusterClient, err := metadataclient.NewDynamicMetadataClusterClientForConfig(rootShardConfig)
@@ -321,3 +324,32 @@ func TestBuiltInCrossLogicalClusterListPartialObjectMetadata(t *testing.T) {
321324

322325
require.Subset(t, sets.List[string](names), expected)
323326
}
327+
328+
func createSheriff(
329+
ctx context.Context,
330+
t *testing.T,
331+
dynamicClusterClient kcpdynamic.ClusterInterface,
332+
clusterName logicalcluster.Path,
333+
group string,
334+
) {
335+
t.Helper()
336+
337+
name := strings.ReplaceAll(clusterName.String(), ":", "-")
338+
339+
t.Logf("Creating %s/v1 sheriffs %s|default/%s", group, clusterName, name)
340+
341+
sheriffsGVR := schema.GroupVersionResource{Group: group, Resource: "sheriffs", Version: "v1"}
342+
343+
sheriff := &unstructured.Unstructured{}
344+
sheriff.SetAPIVersion(group + "/v1")
345+
sheriff.SetKind("Sheriff")
346+
sheriff.SetName(name)
347+
348+
// CRDs are asynchronously served because they are informer based.
349+
kcptestinghelpers.Eventually(t, func() (bool, string) {
350+
if _, err := dynamicClusterClient.Cluster(clusterName).Resource(sheriffsGVR).Namespace("default").Create(ctx, sheriff, metav1.CreateOptions{}); err != nil {
351+
return false, fmt.Sprintf("failed to create Sheriff %s|%s: %v", clusterName, name, err.Error())
352+
}
353+
return true, ""
354+
}, wait.ForeverTestTimeout, time.Millisecond*100, "error creating Sheriff %s|%s", clusterName, name)
355+
}

test/e2e/fixtures/apifixtures/sheriffs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ func CreateSheriffsSchemaAndExport(
185185

186186
// CreateSheriff creates an instance of a Sheriff CustomResource in the logical cluster identified by clusterName, in
187187
// the specific API group, and with the specified name.
188+
//
188189
// Deprecated: use local fixtures instead.
189190
func CreateSheriff(
190191
ctx context.Context,

test/e2e/quota/quota_test.go

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package quota
1919
import (
2020
"context"
2121
"fmt"
22+
"strings"
2223
"testing"
2324
"time"
2425

@@ -314,15 +315,15 @@ func TestKubeQuotaNormalCRDs(t *testing.T) {
314315
}, wait.ForeverTestTimeout, 100*time.Millisecond, "error waiting for ws %d quota to show usage in status", wsIndex)
315316

316317
t.Logf("Create 2 sheriffs to reach the quota limit")
317-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, ws, group, fmt.Sprintf("ws%d-1", wsIndex))
318-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, ws, group, fmt.Sprintf("ws%d-2", wsIndex))
318+
createSheriff(ctx, t, dynamicClusterClient, ws, group, fmt.Sprintf("ws%d-1", wsIndex))
319+
createSheriff(ctx, t, dynamicClusterClient, ws, group, fmt.Sprintf("ws%d-2", wsIndex))
319320

320321
t.Logf("Make sure quota is enforcing limits")
321322
i := 0
322323
sheriffsGVR := schema.GroupVersionResource{Group: group, Resource: "sheriffs", Version: "v1"}
323324
kcptestinghelpers.Eventually(t, func() (bool, string) {
324325
t.Logf("Trying to create a sheriff")
325-
sheriff := NewSheriff(group, fmt.Sprintf("ws%d-%d", wsIndex, i))
326+
sheriff := newSheriff(group, fmt.Sprintf("ws%d-%d", wsIndex, i))
326327
i++
327328
_, err := dynamicClusterClient.Cluster(ws).Resource(sheriffsGVR).Namespace("default").Create(ctx, sheriff, metav1.CreateOptions{})
328329
return apierrors.IsForbidden(err), fmt.Sprintf("expected a forbidden error, got: %v", err)
@@ -461,15 +462,38 @@ func bootstrapCRD(
461462
require.NoError(t, err, "error bootstrapping CRD %s in cluster %s", crd.Name, clusterName)
462463
}
463464

464-
// NewSheriff returns a new *unstructured.Unstructured for a Sheriff with the given group and name.
465-
func NewSheriff(group, name string) *unstructured.Unstructured {
466-
return &unstructured.Unstructured{
467-
Object: map[string]interface{}{
468-
"apiVersion": group + "/v1",
469-
"kind": "Sheriff",
470-
"metadata": map[string]interface{}{
471-
"name": name,
472-
},
473-
},
474-
}
465+
// newSheriff returns a new *unstructured.Unstructured for a Sheriff with the given group and name.
466+
func newSheriff(group, name string) *unstructured.Unstructured {
467+
sheriff := &unstructured.Unstructured{}
468+
sheriff.SetAPIVersion(group + "/v1")
469+
sheriff.SetKind("Sheriff")
470+
sheriff.SetName(name)
471+
472+
return sheriff
473+
}
474+
475+
func createSheriff(
476+
ctx context.Context,
477+
t *testing.T,
478+
dynamicClusterClient kcpdynamic.ClusterInterface,
479+
clusterName logicalcluster.Path,
480+
group, name string,
481+
) {
482+
t.Helper()
483+
484+
name = strings.ReplaceAll(name, ":", "-")
485+
486+
t.Logf("Creating %s/v1 sheriffs %s|default/%s", group, clusterName, name)
487+
488+
sheriffsGVR := schema.GroupVersionResource{Group: group, Resource: "sheriffs", Version: "v1"}
489+
490+
sheriff := newSheriff(group, name)
491+
492+
// CRDs are asynchronously served because they are informer based.
493+
kcptestinghelpers.Eventually(t, func() (bool, string) {
494+
if _, err := dynamicClusterClient.Cluster(clusterName).Resource(sheriffsGVR).Namespace("default").Create(ctx, sheriff, metav1.CreateOptions{}); err != nil {
495+
return false, fmt.Sprintf("failed to create Sheriff %s|%s: %v", clusterName, name, err.Error())
496+
}
497+
return true, ""
498+
}, wait.ForeverTestTimeout, time.Millisecond*100, "error creating Sheriff %s|%s", clusterName, name)
475499
}

0 commit comments

Comments
 (0)