From 05bd5f846feaa8a50ef20216b9733b930e06275f Mon Sep 17 00:00:00 2001 From: Mustafa Abdelrahman Date: Wed, 14 Aug 2024 15:38:15 +0200 Subject: [PATCH] staticcheck: fix pipeline errors (#3190) pipeline link: https://github.com/zalando/skipper/actions/runs/10387833964/job/28762375336\?pr\=3188 Signed-off-by: Mustafa Abdelrahman --- config/config.go | 2 +- filters/apiusagemonitoring/spec.go | 2 +- filters/tls/pass_client_test.go | 2 +- swarm/swarm.go | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/config.go b/config/config.go index 77e3ab224c..d9cb8d25c5 100644 --- a/config/config.go +++ b/config/config.go @@ -959,7 +959,7 @@ func (c *Config) ToOptions() skipper.Options { options.ProxyFlags |= proxy.PatchPath } - if c.Certificates != nil && len(c.Certificates) > 0 { + if len(c.Certificates) > 0 { options.ClientTLS = &tls.Config{ Certificates: c.Certificates, MinVersion: c.getMinTLSVersion(), diff --git a/filters/apiusagemonitoring/spec.go b/filters/apiusagemonitoring/spec.go index bbd5425db6..fa7099be27 100644 --- a/filters/apiusagemonitoring/spec.go +++ b/filters/apiusagemonitoring/spec.go @@ -235,7 +235,7 @@ func (s *apiUsageMonitoringSpec) buildPathInfoListFromConfiguration(apis []*apiC continue } - if api.PathTemplates == nil || len(api.PathTemplates) == 0 { + if len(api.PathTemplates) == 0 { s.warnf("args[%d] ignored: does not specify any path template", apiIndex) continue } diff --git a/filters/tls/pass_client_test.go b/filters/tls/pass_client_test.go index 3caa1a6686..16e0a87f94 100644 --- a/filters/tls/pass_client_test.go +++ b/filters/tls/pass_client_test.go @@ -199,7 +199,7 @@ func TestPassTLSClientCert_PEM(t *testing.T) { req, err := http.NewRequest(http.MethodGet, "http://example.com/foo", nil) require.NoError(t, err) - if test.certContents != nil && len(test.certContents) > 0 { + if len(test.certContents) > 0 { req.TLS = buildTLSWith(test.certContents) } diff --git a/swarm/swarm.go b/swarm/swarm.go index 6e4b98e33c..6b1eb81dbe 100644 --- a/swarm/swarm.go +++ b/swarm/swarm.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io" + "math" "net" "time" @@ -156,7 +157,7 @@ func newKubernetesSwarm(o Options) (*Swarm, error) { } o.KubernetesOptions.KubernetesAPIBaseURL = u - if o.SwarmPort == 0 || o.SwarmPort >= 65535 { + if o.SwarmPort == 0 || o.SwarmPort == math.MaxUint16 { log.Errorf("Wrong SwarmPort %d, set to default %d instead", o.SwarmPort, DefaultPort) o.SwarmPort = DefaultPort }