Skip to content

Commit

Permalink
chore: bump golangci-lint to v1.61.0
Browse files Browse the repository at this point in the history
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
  • Loading branch information
aramase committed Oct 10, 2024
1 parent 95bfaad commit 2709153
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
8 changes: 8 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ linters:
# Run with --fast=false for more extensive checks
fast: true

issues:
# default: 50
max-issues-per-linter: 0
exclude-rules:
- text: "unused-parameter: parameter '.*' seems to be unused, consider removing or renaming it as _"
linters:
- revive

linters-settings:
goimports:
local-prefixes: github.com/Azure/azure-workload-identity
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ KUSTOMIZE_VER := v4.1.2
KUSTOMIZE_BIN := kustomize
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)

GOLANGCI_LINT_VER := v1.52.2
GOLANGCI_LINT_VER := v1.
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)

Expand Down Expand Up @@ -365,7 +365,7 @@ clean:

.PHONY: lint
lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT) run -v
$(GOLANGCI_LINT) run -v --timeout 5m

.PHONY: helm-lint
helm-lint: $(HELM)
Expand Down
11 changes: 6 additions & 5 deletions pkg/cmd/podidentity/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import (
aadpodv1 "github.com/Azure/aad-pod-identity/pkg/apis/aadpodidentity/v1"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"monis.app/mlog"
"sigs.k8s.io/controller-runtime/pkg/client"

appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
Expand All @@ -20,8 +23,6 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer/json"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"monis.app/mlog"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/Azure/azure-workload-identity/pkg/cmd/podidentity/k8s"
"github.com/Azure/azure-workload-identity/pkg/cmd/serviceaccount/options"
Expand Down Expand Up @@ -60,7 +61,7 @@ func init() {
type detectCmd struct {
namespace string
outputDir string
proxyPort int
proxyPort int32
serviceAccountTokenExpiration time.Duration
tenantID string
kubeClient client.Client
Expand All @@ -85,7 +86,7 @@ func newDetectCmd() *cobra.Command {
f := cmd.Flags()
f.StringVar(&detectCmd.namespace, "namespace", "default", "Namespace to detect the configuration")
f.StringVarP(&detectCmd.outputDir, "output-dir", "o", "", "Output directory to write the configuration files")
f.IntVarP(&detectCmd.proxyPort, "proxy-port", "p", 8000, "Proxy port to use for the proxy container")
f.Int32VarP(&detectCmd.proxyPort, "proxy-port", "p", 8000, "Proxy port to use for the proxy container")
f.DurationVar(&detectCmd.serviceAccountTokenExpiration, options.ServiceAccountTokenExpiration.Flag, time.Duration(webhook.DefaultServiceAccountTokenExpiration)*time.Second, options.ServiceAccountTokenExpiration.Description)
f.StringVar(&detectCmd.tenantID, "tenant-id", "", "Managed identity tenant id. If specified, the tenant id will be set as an annotation on the service account.")

Expand Down Expand Up @@ -349,7 +350,7 @@ func (dc *detectCmd) addProxyInitContainer(initContainers []corev1.Container) []
Env: []corev1.EnvVar{
{
Name: "PROXY_PORT",
Value: strconv.Itoa(dc.proxyPort),
Value: strconv.FormatInt(int64(dc.proxyPort), 10),
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/webhook/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (
// This is the Kubernetes default value for projected service account token
DefaultServiceAccountTokenExpiration = int64(3600)
// DefaultProxySidecarPort is the default port for proxy sidecar
DefaultProxySidecarPort = int32(8000)
DefaultProxySidecarPort = 8000
)

const (
Expand Down
9 changes: 5 additions & 4 deletions pkg/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ import (

"github.com/Azure/go-autorest/autorest/azure"
"github.com/pkg/errors"
"monis.app/mlog"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/ptr"
"monis.app/mlog"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/Azure/azure-workload-identity/pkg/config"
)
Expand Down Expand Up @@ -334,7 +335,7 @@ func getProxyPort(pod *corev1.Pod) (int32, error) {
return 0, errors.Wrap(err, "failed to parse proxy sidecar port")
}

return int32(parsed), nil
return int32(parsed), nil //nolint:gosec // disable G115
}

func validServiceAccountTokenExpiry(tokenExpiry int64) bool {
Expand Down

0 comments on commit 2709153

Please sign in to comment.