From 331bf79a32f4eaa3209088c7ca3863de27c49c2e Mon Sep 17 00:00:00 2001 From: Jakub Warczarek Date: Wed, 25 Oct 2023 15:05:29 +0200 Subject: [PATCH] chore(linter): in switch case default signifies exhaustive match and fix forbidigo (#850) --- .golangci.yaml | 4 +++- pkg/clusters/addons/kong/addon.go | 2 +- pkg/clusters/addons/kong/builder.go | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 29ac9b3a..1e1bb5f3 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -35,6 +35,8 @@ linters: - wastedassign linters-settings: + exhaustive: + default-signifies-exhaustive: true gci: sections: - standard @@ -82,7 +84,7 @@ linters-settings: - pkg: sigs.k8s.io/gateway-api/apis/(v[\w\d]+) alias: gateway${1} forbidigo: - exclude_godoc_examples: false + exclude-godoc-examples: false forbid: - 'CoreV1\(\)\.Endpoints(# use DiscoveryV1 EndpointSlices API instead)?' - 'corev1\.Endpoint(# use DiscoveryV1 EndpointSlices API instead)?' diff --git a/pkg/clusters/addons/kong/addon.go b/pkg/clusters/addons/kong/addon.go index a6c63e7a..c64fbbb4 100644 --- a/pkg/clusters/addons/kong/addon.go +++ b/pkg/clusters/addons/kong/addon.go @@ -628,7 +628,7 @@ func urlForService(ctx context.Context, cluster clusters.Cluster, nsn types.Name return nil, err } - switch service.Spec.Type { //nolint:exhaustive + switch service.Spec.Type { case corev1.ServiceTypeLoadBalancer: if len(service.Status.LoadBalancer.Ingress) == 1 { return url.Parse(fmt.Sprintf("http://%s:%d", service.Status.LoadBalancer.Ingress[0].IP, port)) diff --git a/pkg/clusters/addons/kong/builder.go b/pkg/clusters/addons/kong/builder.go index 4ec4bd7c..c60bdf7a 100644 --- a/pkg/clusters/addons/kong/builder.go +++ b/pkg/clusters/addons/kong/builder.go @@ -86,7 +86,7 @@ func (b *Builder) Build() *Addon { } // LoadBalancer is used by default for historical and convenience reasons. - switch b.proxyServiceType { //nolint:exhaustive + switch b.proxyServiceType { case "": b.proxyServiceType = corev1.ServiceTypeLoadBalancer case corev1.ServiceTypeNodePort: @@ -94,6 +94,7 @@ func (b *Builder) Build() *Addon { if b.httpNodePort == 0 { b.httpNodePort = DefaultProxyNodePort } + default: } return &Addon{