Skip to content

Commit

Permalink
fix: bump golint version to fix failing job (#638)
Browse files Browse the repository at this point in the history
* bump golint version

* bump golint version

* fix lint issues

* updated

* updated

* updated

* updated
  • Loading branch information
mfaizanse committed Sep 17, 2024
1 parent 5e6e576 commit 5488a72
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.57
version: v1.60.1
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ linters:
- paralleltest
- copyloopvar
- perfsprint
- gomnd

linters-settings:
stylecheck:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
## Tool Versions
KUSTOMIZE_VERSION ?= v5.0.0
CONTROLLER_TOOLS_VERSION ?= v0.16.1
GOLANG_CI_LINT_VERSION ?= v1.57
GOLANG_CI_LINT_VERSION ?= v1.60.1

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand Down
2 changes: 1 addition & 1 deletion hack/e2e/common/fixtures/fixtures.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//nolint:gomnd // used in tests
//nolint:mnd // used in tests
package fixtures

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (r *Reconciler) enqueueReconciliationForSubscriptions(subs []eventingv1alph
// handleSubscriptionDeletion deletes the JetStream subscription and removes its finalizer if it is set.
func (r *Reconciler) handleSubscriptionDeletion(ctx context.Context,
subscription *eventingv1alpha2.Subscription, log *zap.SugaredLogger,
) (kctrl.Result, error) {
) (kctrl.Result, error) { //nolint:unparam // used as needed.
// delete the JetStream subscription/consumer
if !utils.ContainsString(subscription.ObjectMeta.Finalizers, eventingv1alpha2.Finalizer) {
return kctrl.Result{}, nil
Expand Down Expand Up @@ -344,7 +344,7 @@ func (r *Reconciler) updateStatus(ctx context.Context, oldSubscription,
}

// addFinalizer appends the eventing finalizer to the subscription and updates it in k8s.
func (r *Reconciler) addFinalizer(ctx context.Context, sub *eventingv1alpha2.Subscription) (kctrl.Result, error) {
func (r *Reconciler) addFinalizer(ctx context.Context, sub *eventingv1alpha2.Subscription) (kctrl.Result, error) { //nolint:unparam // used as needed.
sub.ObjectMeta.Finalizers = append(sub.ObjectMeta.Finalizers, eventingv1alpha2.Finalizer)

// update the subscription's finalizers in k8s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const (
wrongSecret = "gibberish"
publisher = "publisher"
replicas = "replicas"
max = "max"
min = "min"
max = "max" //nolint:predeclared // used in tests
min = "min" //nolint:predeclared // used in tests
resources = "resources"
limits = "limits"
requests = "requests"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ems/api/events/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (c Client) Publish(event cloudevents.Event, qos types.Qos) (*types.PublishR
}

// set required headers
req.Header.Set("qos", string(qos))
req.Header.Set("qos", string(qos)) //nolint:canonicalheader // used as required.

var response types.PublishResponse
status, responseBody, err := c.client.Do(req, &response)
Expand Down
6 changes: 3 additions & 3 deletions pkg/eventing/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func GetPublisherClusterRoleBindingName(eventing v1alpha1.Eventing) string {
return fmt.Sprintf("%s-%s", eventing.GetName(), publisherProxySuffix)
}

func newHorizontalPodAutoscaler(name, namespace string, min, max, cpuUtilization, memoryUtilization int32,
func newHorizontalPodAutoscaler(name, namespace string, minReplicas, maxReplicas, cpuUtilization, memoryUtilization int32,
labels map[string]string,
) *kautoscalingv2.HorizontalPodAutoscaler {
return &kautoscalingv2.HorizontalPodAutoscaler{
Expand All @@ -61,8 +61,8 @@ func newHorizontalPodAutoscaler(name, namespace string, min, max, cpuUtilization
Name: name,
APIVersion: "apps/v1",
},
MinReplicas: &min,
MaxReplicas: max,
MinReplicas: &minReplicas,
MaxReplicas: maxReplicas,
Metrics: []kautoscalingv2.MetricSpec{
{
Type: kautoscalingv2.ResourceMetricSourceType,
Expand Down
1 change: 1 addition & 0 deletions pkg/tracing/tracing.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//nolint:canonicalheader // used as required in tracing.
package tracing

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/tracing/tracing_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//nolint:canonicalheader // used as required in tracing.
package tracing

import (
Expand Down
2 changes: 1 addition & 1 deletion test/utils/utils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//nolint:gomnd // magic numbers here are used only in context of the function
//nolint:mnd // magic numbers here are used only in context of the function
package utils

import (
Expand Down
14 changes: 7 additions & 7 deletions testing/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ func GetStructuredMessageHeaders() http.Header {

func GetBinaryMessageHeaders() http.Header {
headers := make(http.Header)
headers.Add(CeIDHeader, EventID)
headers.Add(CeTypeHeader, CloudEventType)
headers.Add(CeSourceHeader, CloudEventSource)
headers.Add(CeSpecVersionHeader, CloudEventSpecVersion)
headers.Add(CeIDHeader, EventID) //nolint:canonicalheader // used in testing.
headers.Add(CeTypeHeader, CloudEventType) //nolint:canonicalheader // used in testing.
headers.Add(CeSourceHeader, CloudEventSource) //nolint:canonicalheader // used in testing.
headers.Add(CeSpecVersionHeader, CloudEventSpecVersion) //nolint:canonicalheader // used in testing.
return headers
}

Expand Down Expand Up @@ -186,7 +186,7 @@ func NewAPIRule(subscription *eventingv1alpha2.Subscription, opts ...APIRuleOpti

func WithService(name, host string) APIRuleOption {
return func(r *apigatewayv1beta1.APIRule) {
port := uint32(443) //nolint:gomnd // tests
port := uint32(443) //nolint:mnd // tests
isExternal := true
r.Spec.Host = &host
r.Spec.Service = &apigatewayv1beta1.Service{
Expand Down Expand Up @@ -531,9 +531,9 @@ func NewSubscriberSvc(name, namespace string) *kcorev1.Service {
Ports: []kcorev1.ServicePort{
{
Protocol: "TCP",
Port: 443, //nolint:gomnd // tests
Port: 443, //nolint:mnd // tests
TargetPort: intstr.IntOrString{
IntVal: 8080, //nolint:gomnd // tests
IntVal: 8080, //nolint:mnd // tests
},
},
},
Expand Down

0 comments on commit 5488a72

Please sign in to comment.