Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump golangci-lint #479

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
run:
timeout: 30m
go: '1.19'
go: '1.21'
skip-files:
- "^zz_generated.*"

Expand Down Expand Up @@ -30,5 +30,13 @@ linters-settings:
"-SA2002"
]

revive:
rules:
- name: unused-parameter
severity: warning
disabled: false
arguments:
- allowRegex: "^_"

unused:
go: "1.19"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ license-eye: ## Download license-eye locally if necessary

GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
golangci-lint:
$(call go-get-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.1)
$(call go-get-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2)

# go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/common/selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func MustAsSelector(ps *metav1.LabelSelector) labels.Selector {
return ls
}

func MustNewRequirement(key string, op selection.Operator, vals []string, opts ...field.PathOption) labels.Requirement {
func MustNewRequirement(key string, op selection.Operator, vals []string, _ ...field.PathOption) labels.Requirement {
r, err := labels.NewRequirement(key, op, vals)
if err != nil {
panic(errors.Wrap(err, "impossible path: new requirement failed"))
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/common/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func DeploymentTemplate(obj client.Object, name string) *appsv1.Deployment {
func PersistentVolumeClaimTemplate(size resource.Quantity, sc *string, name string) corev1.PersistentVolumeClaim {
return corev1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{
Name: DataVolume,
Name: name,
},
Spec: corev1.PersistentVolumeClaimSpec{
AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce},
Expand Down
6 changes: 3 additions & 3 deletions pkg/hook/cnclaim.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ func NewCNClaimHook(cli client.Client, logger logr.Logger) *CNClaimHook {
}
}

func (h *CNClaimHook) ValidateCreate(ctx context.Context, obj runtime.Object) (warnings admission.Warnings, err error) {
func (h *CNClaimHook) ValidateCreate(_ context.Context, _ runtime.Object) (warnings admission.Warnings, err error) {
return nil, nil
}

func (h *CNClaimHook) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (warnings admission.Warnings, err error) {
func (h *CNClaimHook) ValidateUpdate(_ context.Context, oldObj, newObj runtime.Object) (warnings admission.Warnings, err error) {
var errs field.ErrorList
oldClaim, ok := oldObj.(*v1alpha1.CNClaim)
if !ok {
Expand All @@ -59,7 +59,7 @@ func (h *CNClaimHook) ValidateUpdate(ctx context.Context, oldObj, newObj runtime
return nil, invalidOrNil(errs, newClaim)
}

func (h *CNClaimHook) ValidateDelete(ctx context.Context, obj runtime.Object) (warnings admission.Warnings, err error) {
func (h *CNClaimHook) ValidateDelete(_ context.Context, _ runtime.Object) (warnings admission.Warnings, err error) {
return nil, nil
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/hook/cnclaimset.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ func NewCNClaimSetHook(cli client.Client, logger logr.Logger) *CNClaimSetHook {
}
}

func (h *CNClaimSetHook) Default(ctx context.Context, obj runtime.Object) error {
func (h *CNClaimSetHook) Default(_ context.Context, _ runtime.Object) error {
return nil
}

func (h *CNClaimSetHook) ValidateCreate(ctx context.Context, obj runtime.Object) (warnings admission.Warnings, err error) {
func (h *CNClaimSetHook) ValidateCreate(_ context.Context, _ runtime.Object) (warnings admission.Warnings, err error) {
return nil, nil
}

func (h *CNClaimSetHook) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (warnings admission.Warnings, err error) {
func (h *CNClaimSetHook) ValidateUpdate(_ context.Context, oldObj, newObj runtime.Object) (warnings admission.Warnings, err error) {
oldCS, ok := oldObj.(*v1alpha1.CNClaimSet)
if !ok {
return nil, nil
Expand All @@ -62,7 +62,7 @@ func (h *CNClaimSetHook) ValidateUpdate(ctx context.Context, oldObj, newObj runt
return nil, nil
}

func (h *CNClaimSetHook) ValidateDelete(ctx context.Context, obj runtime.Object) (warnings admission.Warnings, err error) {
func (h *CNClaimSetHook) ValidateDelete(_ context.Context, _ runtime.Object) (warnings admission.Warnings, err error) {
return nil, nil
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/mosql/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ func NewFakeClient(_ string, _ client.Client, _ types.NamespacedName) Client {

type fakeClient struct{}

func (c *fakeClient) GetServerConnection(ctx context.Context, uid string) (int, error) {
func (c *fakeClient) GetServerConnection(_ context.Context, _ string) (int, error) {
return 0, nil
}

func (c *fakeClient) Query(ctx context.Context, query string, args ...any) (*sql.Rows, error) {
func (c *fakeClient) Query(_ context.Context, _ string, _ ...any) (*sql.Rows, error) {
return nil, nil
}
Loading