Skip to content

Commit

Permalink
Merge pull request crossplane#5414 from negz/underscores
Browse files Browse the repository at this point in the history
Bump golangci-lint to v1.56.2
  • Loading branch information
negz authored Feb 21, 2024
2 parents 5369ee3 + 1b58adf commit dd131a7
Show file tree
Hide file tree
Showing 53 changed files with 411 additions and 411 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
env:
# Common versions
GO_VERSION: '1.22.0'
GOLANGCI_VERSION: 'v1.55.2'
GOLANGCI_VERSION: 'v1.56.2'
DOCKER_BUILDX_VERSION: 'v0.10.0'

# Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ GO_TEST_PACKAGES = $(GO_PROJECT)/test/e2e
GO_LDFLAGS += -X $(GO_PROJECT)/internal/version.version=$(VERSION)
GO_SUBDIRS += cmd internal apis
GO111MODULE = on
GOLANGCILINT_VERSION = 1.55.2
GOLANGCILINT_VERSION = 1.56.2
GO_LINT_ARGS ?= "--fix"

-include build/makelib/golang.mk
Expand Down
2 changes: 1 addition & 1 deletion cmd/crank/beta/render/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ func TestRender(t *testing.T) {
Functions: []pkgv1beta1.Function{
func() pkgv1beta1.Function {
i := 0
lis := NewFunctionWithRunFunc(t, func(ctx context.Context, request *fnv1beta1.RunFunctionRequest) (*fnv1beta1.RunFunctionResponse, error) {
lis := NewFunctionWithRunFunc(t, func(_ context.Context, request *fnv1beta1.RunFunctionRequest) (*fnv1beta1.RunFunctionResponse, error) {
defer func() { i++ }()
switch i {
case 0:
Expand Down
2 changes: 1 addition & 1 deletion cmd/crank/beta/render/runtime_docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
)

type mockPullClient struct {
MockPullImage func(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
MockPullImage func(_ context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
}

func (m *mockPullClient) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/crank/beta/trace/internal/resource/xpkg/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func TestGetDependencyRef(t *testing.T) {
pkgType: v1beta1.FunctionPackageType,
pkg: "example.com/function-1:v1.0.0",
client: &test.MockClient{
MockGet: test.NewMockGetFn(nil, func(obj client.Object) error {
MockGet: test.NewMockGetFn(nil, func(_ client.Object) error {
return kerrors.NewNotFound(schema.GroupResource{}, "whatever")
}),
},
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/apiextensions/claim/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
)

func FuzzPropagateConnection(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
f.Fuzz(func(_ *testing.T, data []byte) {
f := fuzz.NewConsumer(data)
cp := &fake.Composite{}
cm := &fake.CompositeClaim{}
Expand Down Expand Up @@ -62,7 +62,7 @@ func FuzzPropagateConnection(f *testing.F) {
return nil
}),
},
Applicator: resource.ApplyFn(func(_ context.Context, o client.Object, _ ...resource.ApplyOption) error {
Applicator: resource.ApplyFn(func(_ context.Context, _ client.Object, _ ...resource.ApplyOption) error {
return nil
}),
}
Expand Down
44 changes: 22 additions & 22 deletions internal/controller/apiextensions/claim/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ func TestReconcile(t *testing.T) {
})),
}),
WithClaimFinalizer(resource.FinalizerFns{
AddFinalizerFn: func(ctx context.Context, obj resource.Object) error { return nil },
AddFinalizerFn: func(_ context.Context, _ resource.Object) error { return nil },
}),
WithCompositeSyncer(CompositeSyncerFn(func(ctx context.Context, cm *claim.Unstructured, xr *composite.Unstructured) error { return nil })),
WithConnectionPropagator(ConnectionPropagatorFn(func(ctx context.Context, to resource.LocalConnectionSecretOwner, from resource.ConnectionSecretOwner) (propagated bool, err error) {
WithCompositeSyncer(CompositeSyncerFn(func(_ context.Context, _ *claim.Unstructured, _ *composite.Unstructured) error { return nil })),
WithConnectionPropagator(ConnectionPropagatorFn(func(_ context.Context, _ resource.LocalConnectionSecretOwner, _ resource.ConnectionSecretOwner) (propagated bool, err error) {
return true, nil
})),
},
Expand Down Expand Up @@ -235,7 +235,7 @@ func TestReconcile(t *testing.T) {
})),
}),
WithClaimFinalizer(resource.FinalizerFns{
RemoveFinalizerFn: func(ctx context.Context, obj resource.Object) error { return nil },
RemoveFinalizerFn: func(_ context.Context, _ resource.Object) error { return nil },
}),
},
},
Expand All @@ -261,7 +261,7 @@ func TestReconcile(t *testing.T) {
cm.SetConditions(xpv1.ReconcileError(errors.Wrap(errBoom, errDeleteCDs)))
})),
}),
WithConnectionUnpublisher(ConnectionUnpublisherFn(func(ctx context.Context, so resource.LocalConnectionSecretOwner, c managed.ConnectionDetails) error {
WithConnectionUnpublisher(ConnectionUnpublisherFn(func(_ context.Context, _ resource.LocalConnectionSecretOwner, _ managed.ConnectionDetails) error {
return errBoom
})),
},
Expand Down Expand Up @@ -289,7 +289,7 @@ func TestReconcile(t *testing.T) {
})),
}),
WithClaimFinalizer(resource.FinalizerFns{
RemoveFinalizerFn: func(ctx context.Context, obj resource.Object) error { return errBoom },
RemoveFinalizerFn: func(_ context.Context, _ resource.Object) error { return errBoom },
}),
},
},
Expand All @@ -316,7 +316,7 @@ func TestReconcile(t *testing.T) {
})),
}),
WithClaimFinalizer(resource.FinalizerFns{
RemoveFinalizerFn: func(ctx context.Context, obj resource.Object) error { return nil },
RemoveFinalizerFn: func(_ context.Context, _ resource.Object) error { return nil },
}),
},
},
Expand Down Expand Up @@ -350,7 +350,7 @@ func TestReconcile(t *testing.T) {
MockDelete: test.NewMockDeleteFn(nil),
}),
WithClaimFinalizer(resource.FinalizerFns{
RemoveFinalizerFn: func(ctx context.Context, obj resource.Object) error { return nil },
RemoveFinalizerFn: func(_ context.Context, _ resource.Object) error { return nil },
}),
},
},
Expand Down Expand Up @@ -385,7 +385,7 @@ func TestReconcile(t *testing.T) {
}),
}),
WithClaimFinalizer(resource.FinalizerFns{
RemoveFinalizerFn: func(ctx context.Context, obj resource.Object) error { return nil },
RemoveFinalizerFn: func(_ context.Context, _ resource.Object) error { return nil },
}),
},
},
Expand All @@ -406,7 +406,7 @@ func TestReconcile(t *testing.T) {
})),
}),
WithClaimFinalizer(resource.FinalizerFns{
AddFinalizerFn: func(ctx context.Context, obj resource.Object) error { return errBoom },
AddFinalizerFn: func(_ context.Context, _ resource.Object) error { return errBoom },
}),
},
},
Expand All @@ -427,9 +427,9 @@ func TestReconcile(t *testing.T) {
})),
}),
WithClaimFinalizer(resource.FinalizerFns{
AddFinalizerFn: func(ctx context.Context, obj resource.Object) error { return nil },
AddFinalizerFn: func(_ context.Context, _ resource.Object) error { return nil },
}),
WithCompositeSyncer(CompositeSyncerFn(func(ctx context.Context, cm *claim.Unstructured, xr *composite.Unstructured) error { return errBoom })),
WithCompositeSyncer(CompositeSyncerFn(func(_ context.Context, _ *claim.Unstructured, _ *composite.Unstructured) error { return errBoom })),
},
},
want: want{
Expand Down Expand Up @@ -465,9 +465,9 @@ func TestReconcile(t *testing.T) {
})),
}),
WithClaimFinalizer(resource.FinalizerFns{
AddFinalizerFn: func(ctx context.Context, obj resource.Object) error { return nil },
AddFinalizerFn: func(_ context.Context, _ resource.Object) error { return nil },
}),
WithCompositeSyncer(CompositeSyncerFn(func(ctx context.Context, cm *claim.Unstructured, xr *composite.Unstructured) error { return nil })),
WithCompositeSyncer(CompositeSyncerFn(func(_ context.Context, _ *claim.Unstructured, _ *composite.Unstructured) error { return nil })),
},
},
want: want{
Expand Down Expand Up @@ -501,10 +501,10 @@ func TestReconcile(t *testing.T) {
})),
}),
WithClaimFinalizer(resource.FinalizerFns{
AddFinalizerFn: func(ctx context.Context, obj resource.Object) error { return nil },
AddFinalizerFn: func(_ context.Context, _ resource.Object) error { return nil },
}),
WithCompositeSyncer(CompositeSyncerFn(func(ctx context.Context, cm *claim.Unstructured, xr *composite.Unstructured) error { return nil })),
WithConnectionPropagator(ConnectionPropagatorFn(func(ctx context.Context, to resource.LocalConnectionSecretOwner, from resource.ConnectionSecretOwner) (propagated bool, err error) {
WithCompositeSyncer(CompositeSyncerFn(func(_ context.Context, _ *claim.Unstructured, _ *composite.Unstructured) error { return nil })),
WithConnectionPropagator(ConnectionPropagatorFn(func(_ context.Context, _ resource.LocalConnectionSecretOwner, _ resource.ConnectionSecretOwner) (propagated bool, err error) {
return false, errBoom
})),
},
Expand Down Expand Up @@ -542,10 +542,10 @@ func TestReconcile(t *testing.T) {
})),
}),
WithClaimFinalizer(resource.FinalizerFns{
AddFinalizerFn: func(ctx context.Context, obj resource.Object) error { return nil },
AddFinalizerFn: func(_ context.Context, _ resource.Object) error { return nil },
}),
WithCompositeSyncer(CompositeSyncerFn(func(ctx context.Context, cm *claim.Unstructured, xr *composite.Unstructured) error { return nil })),
WithConnectionPropagator(ConnectionPropagatorFn(func(ctx context.Context, to resource.LocalConnectionSecretOwner, from resource.ConnectionSecretOwner) (propagated bool, err error) {
WithCompositeSyncer(CompositeSyncerFn(func(_ context.Context, _ *claim.Unstructured, _ *composite.Unstructured) error { return nil })),
WithConnectionPropagator(ConnectionPropagatorFn(func(_ context.Context, _ resource.LocalConnectionSecretOwner, _ resource.ConnectionSecretOwner) (propagated bool, err error) {
return true, nil
})),
},
Expand Down Expand Up @@ -582,8 +582,8 @@ func NewClaim(m ...ClaimModifier) *claim.Unstructured {
}

// A status update function that ensures the supplied object is the claim we want.
func WantClaim(t *testing.T, want *claim.Unstructured) func(ctx context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error {
return func(ctx context.Context, got client.Object, _ ...client.SubResourceUpdateOption) error {
func WantClaim(t *testing.T, want *claim.Unstructured) func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error {
return func(_ context.Context, got client.Object, _ ...client.SubResourceUpdateOption) error {
// Normally we use a custom Equal method on conditions to ignore the
// lastTransitionTime, but we're using unstructured types here where
// the conditions are just a map[string]any.
Expand Down
10 changes: 5 additions & 5 deletions internal/controller/apiextensions/claim/syncer_csa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestClientSideSync(t *testing.T) {
"GenerateXRNameError": {
reason: "We should return an error if we can't generate an XR name.",
params: params{
ng: names.NameGeneratorFn(func(ctx context.Context, cd resource.Object) error {
ng: names.NameGeneratorFn(func(_ context.Context, _ resource.Object) error {
return errBoom
}),
},
Expand Down Expand Up @@ -132,7 +132,7 @@ func TestClientSideSync(t *testing.T) {
"UpdateClaimResourceRefError": {
reason: "We should return an error if we can't update the claim to persist its resourceRef.",
params: params{
ng: names.NameGeneratorFn(func(ctx context.Context, cd resource.Object) error {
ng: names.NameGeneratorFn(func(_ context.Context, cd resource.Object) error {
cd.SetName("cool-claim-random")
return nil
}),
Expand Down Expand Up @@ -184,7 +184,7 @@ func TestClientSideSync(t *testing.T) {
"ApplyXRError": {
reason: "We should return an error if we can't apply the XR.",
params: params{
ng: names.NameGeneratorFn(func(ctx context.Context, cd resource.Object) error {
ng: names.NameGeneratorFn(func(_ context.Context, cd resource.Object) error {
cd.SetName("cool-claim-random")
return nil
}),
Expand Down Expand Up @@ -239,7 +239,7 @@ func TestClientSideSync(t *testing.T) {
"UpdateClaimStatusError": {
reason: "We should return an error if we can't update the claim's status.",
params: params{
ng: names.NameGeneratorFn(func(ctx context.Context, cd resource.Object) error {
ng: names.NameGeneratorFn(func(_ context.Context, cd resource.Object) error {
cd.SetName("cool-claim-random")
return nil
}),
Expand Down Expand Up @@ -296,7 +296,7 @@ func TestClientSideSync(t *testing.T) {
"XRDoesNotExist": {
reason: "We should create, bind, and sync with an XR when none exists.",
params: params{
ng: names.NameGeneratorFn(func(ctx context.Context, cd resource.Object) error {
ng: names.NameGeneratorFn(func(_ context.Context, cd resource.Object) error {
cd.SetName("cool-claim-random")
return nil
}),
Expand Down
14 changes: 7 additions & 7 deletions internal/controller/apiextensions/claim/syncer_ssa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestServerSideSync(t *testing.T) {
"GenerateXRNameError": {
reason: "We should return an error if we can't generate an XR name.",
params: params{
ng: names.NameGeneratorFn(func(ctx context.Context, cd resource.Object) error {
ng: names.NameGeneratorFn(func(_ context.Context, _ resource.Object) error {
return errBoom
}),
},
Expand All @@ -88,7 +88,7 @@ func TestServerSideSync(t *testing.T) {
"WeirdClaimSpec": {
reason: "We should return an error if the claim spec is not an object.",
params: params{
ng: names.NameGeneratorFn(func(ctx context.Context, cd resource.Object) error {
ng: names.NameGeneratorFn(func(_ context.Context, _ resource.Object) error {
return nil
}),
},
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestServerSideSync(t *testing.T) {
// Fail to update the claim.
MockUpdate: test.NewMockUpdateFn(errBoom),
},
ng: names.NameGeneratorFn(func(ctx context.Context, cd resource.Object) error {
ng: names.NameGeneratorFn(func(_ context.Context, _ resource.Object) error {
return nil
}),
},
Expand Down Expand Up @@ -170,7 +170,7 @@ func TestServerSideSync(t *testing.T) {
// Fail to patch the XR.
MockPatch: test.NewMockPatchFn(errBoom),
},
ng: names.NameGeneratorFn(func(ctx context.Context, cd resource.Object) error {
ng: names.NameGeneratorFn(func(_ context.Context, _ resource.Object) error {
return nil
}),
},
Expand Down Expand Up @@ -228,7 +228,7 @@ func TestServerSideSync(t *testing.T) {
return nil
}),
},
ng: names.NameGeneratorFn(func(ctx context.Context, cd resource.Object) error {
ng: names.NameGeneratorFn(func(_ context.Context, _ resource.Object) error {
return nil
}),
},
Expand Down Expand Up @@ -285,7 +285,7 @@ func TestServerSideSync(t *testing.T) {
// Fail to update the claim's status.
MockStatusUpdate: test.NewMockSubResourceUpdateFn(errBoom),
},
ng: names.NameGeneratorFn(func(ctx context.Context, cd resource.Object) error {
ng: names.NameGeneratorFn(func(_ context.Context, _ resource.Object) error {
return nil
}),
},
Expand Down Expand Up @@ -345,7 +345,7 @@ func TestServerSideSync(t *testing.T) {
// Update the claim's status.
MockStatusUpdate: test.NewMockSubResourceUpdateFn(nil),
},
ng: names.NameGeneratorFn(func(ctx context.Context, cd resource.Object) error {
ng: names.NameGeneratorFn(func(_ context.Context, cd resource.Object) error {
// Generate a name for the XR.
cd.SetName("cool-claim-random")
return nil
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/apiextensions/composite/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func TestFetchRevision(t *testing.T) {
}),
},
// This should not be called.
Applicator: resource.ApplyFn(func(c context.Context, o client.Object, ao ...resource.ApplyOption) error { return errBoom }),
Applicator: resource.ApplyFn(func(_ context.Context, _ client.Object, _ ...resource.ApplyOption) error { return errBoom }),
},
args: args{
cr: &fake.Composite{
Expand Down Expand Up @@ -359,7 +359,7 @@ func TestFetchRevision(t *testing.T) {
return nil
}),
},
Applicator: resource.ApplyFn(func(c context.Context, o client.Object, ao ...resource.ApplyOption) error {
Applicator: resource.ApplyFn(func(_ context.Context, o client.Object, _ ...resource.ApplyOption) error {
// Ensure we were updated to reference the latest CompositionRevision.
want := &fake.Composite{
CompositionReferencer: fake.CompositionReferencer{
Expand Down Expand Up @@ -416,7 +416,7 @@ func TestFetchRevision(t *testing.T) {
return nil
}),
},
Applicator: resource.ApplyFn(func(c context.Context, o client.Object, ao ...resource.ApplyOption) error {
Applicator: resource.ApplyFn(func(_ context.Context, o client.Object, _ ...resource.ApplyOption) error {
// Ensure we were updated to reference the latest CompositionRevision.
want := &fake.Composite{
CompositionReferencer: fake.CompositionReferencer{
Expand Down Expand Up @@ -474,7 +474,7 @@ func TestFetchRevision(t *testing.T) {
return nil
}),
},
Applicator: resource.ApplyFn(func(c context.Context, o client.Object, ao ...resource.ApplyOption) error {
Applicator: resource.ApplyFn(func(_ context.Context, _ client.Object, _ ...resource.ApplyOption) error {
return errBoom
}),
},
Expand Down
Loading

0 comments on commit dd131a7

Please sign in to comment.