From 9f082469e1969d3f18442929f27288618121defc Mon Sep 17 00:00:00 2001 From: Zlatko Bratkovic Date: Mon, 10 Jun 2024 16:57:50 +0200 Subject: [PATCH] BUILD/MEDIUM: update linter to 1.59.1 version --- .golangci.yml | 19 +++++-------------- Makefile | 2 +- deploy/tests/e2e/utils.go | 2 +- .../customresources/customresource_test.go | 4 ++-- pkg/annotations/service/checkHTTP.go | 4 ++-- pkg/annotations/service/loadbalance.go | 3 ++- pkg/gateways/updates.go | 1 - pkg/handler/https.go | 2 +- pkg/handler/tcp-services.go | 2 +- pkg/haproxy/api/backend.go | 6 +++--- pkg/haproxy/api/runtime.go | 4 ++-- pkg/haproxy/certs/main.go | 12 ++++++------ pkg/haproxy/env/main.go | 3 ++- pkg/haproxy/maps/main.go | 3 +-- pkg/haproxy/process/direct-control.go | 2 +- pkg/haproxy/rules/main.go | 3 ++- pkg/haproxy/rules/reqAcceptContent.go | 4 ++-- pkg/haproxy/rules/reqInspectDelay.go | 4 ++-- pkg/haproxy/rules/reqPathRewrite.go | 4 ++-- pkg/haproxy/rules/reqRatelimit.go | 3 ++- pkg/haproxy/rules/reqRequestRedirect.go | 3 ++- pkg/haproxy/rules/reqRequestRedirectQuic.go | 4 ++-- pkg/haproxy/rules/reqTrack.go | 3 ++- pkg/haproxy/rules/setHdr.go | 4 ++-- pkg/job/crd-check.go | 2 +- pkg/k8s/main.go | 2 +- pkg/route/route.go | 3 ++- pkg/service/endpoints.go | 6 ++++-- 28 files changed, 56 insertions(+), 58 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 59297b1e..b8f90be0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,12 +1,10 @@ linters-settings: govet: - check-shadowing: true + shadow: true gocyclo: min-complexity: 42 cyclop: max-complexity: 42 - maligned: - suggest-new: true dupl: threshold: 200 revive: @@ -20,7 +18,6 @@ linters: - ireturn - dupl - exhaustive - - exhaustivestruct - funlen - gci - gochecknoglobals @@ -28,7 +25,6 @@ linters: - goconst - gocyclo - godot - - goerr113 - gomnd - lll - nestif @@ -39,19 +35,14 @@ linters: - paralleltest - testpackage - varnamelen - - nosnakecase - exhaustruct - nonamedreturns - forcetypeassert - - golint #deprecated - - varcheck #deprecated - - ifshort #deprecated - - structcheck #deprecated - - maligned #deprecated - - scopelint #deprecated - - interfacer #deprecated - - deadcode #deprecated + - execinquery #deprecated - depguard + - mnd + - inamedparam + - err113 # maybe tmp disable issues: exclude: - "tag is not aligned, should be:" # this is harder to read diff --git a/Makefile b/Makefile index 00dbf52d..0368d338 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ PROJECT_PATH=${PWD} TARGETPLATFORM?=linux/amd64 GOOS?=linux GOARCH?=amd64 -GOLANGCI_LINT_VERSION=1.54.2 +GOLANGCI_LINT_VERSION=1.59.1 .PHONY: test test: diff --git a/deploy/tests/e2e/utils.go b/deploy/tests/e2e/utils.go index 1d48a2eb..afba658f 100644 --- a/deploy/tests/e2e/utils.go +++ b/deploy/tests/e2e/utils.go @@ -131,7 +131,7 @@ func (t *Test) GetK8sVersion() (major, minor int, err error) { if err != nil { return 0, 0, err } - config, err := clientcmd.BuildConfigFromFlags("", fmt.Sprintf("%s/.kube/config", home)) + config, err := clientcmd.BuildConfigFromFlags("", home+"/.kube/config") if err != nil { return 0, 0, err } diff --git a/deploy/tests/integration/customresources/customresource_test.go b/deploy/tests/integration/customresources/customresource_test.go index b4099eff..c57a2af5 100644 --- a/deploy/tests/integration/customresources/customresource_test.go +++ b/deploy/tests/integration/customresources/customresource_test.go @@ -45,8 +45,8 @@ func (suite *CustomResourceSuite) TestGlobalCR() { suite.globalCREvt.EventProcessed = eventProcessedChan testController.EventChan <- suite.globalCREvt <-eventProcessedChan - assert.Len(t, globals, 0, "No Global CR should be present") - assert.Len(t, logtrargets, 0, "No LogTargets should be present") + assert.Empty(t, globals, "No Global CR should be present") + assert.Empty(t, logtrargets, "No LogTargets should be present") }) suite.StopController() diff --git a/pkg/annotations/service/checkHTTP.go b/pkg/annotations/service/checkHTTP.go index c0602c40..c52727c1 100644 --- a/pkg/annotations/service/checkHTTP.go +++ b/pkg/annotations/service/checkHTTP.go @@ -1,7 +1,7 @@ package service import ( - "fmt" + "errors" "strings" "github.com/haproxytech/client-native/v5/models" @@ -34,7 +34,7 @@ func (a *CheckHTTP) Process(k store.K8s, annotations ...map[string]string) error checkHTTPParams := strings.Fields(strings.TrimSpace(input)) switch len(checkHTTPParams) { case 0: - return fmt.Errorf("httpchk option: incorrect number of params") + return errors.New("httpchk option: incorrect number of params") case 1: params = &models.HttpchkParams{ URI: checkHTTPParams[0], diff --git a/pkg/annotations/service/loadbalance.go b/pkg/annotations/service/loadbalance.go index 76d32cda..133bf82f 100644 --- a/pkg/annotations/service/loadbalance.go +++ b/pkg/annotations/service/loadbalance.go @@ -1,6 +1,7 @@ package service import ( + "errors" "fmt" "regexp" "strconv" @@ -49,7 +50,7 @@ func getParamsFromInput(value string) (*models.Balance, error) { balance := &models.Balance{} tokens := strings.Split(value, " ") if len(tokens) == 0 { - return nil, fmt.Errorf("missing algorithm name") + return nil, errors.New("missing algorithm name") } reg := regexp.MustCompile(`(\(|\))`) diff --git a/pkg/gateways/updates.go b/pkg/gateways/updates.go index b0b9ead4..d61c3b70 100644 --- a/pkg/gateways/updates.go +++ b/pkg/gateways/updates.go @@ -175,7 +175,6 @@ func (statusMgr *StatusManagerImpl) UpdateStatusTCPRoutes(routesStatusRecords [] } for _, parentStatusRecord := range tcprouteStatusRecord.parentsStatusesRecords { - parentStatusRecord := parentStatusRecord conditions := []metav1.Condition{} routeParentStatus := v1alpha2.RouteParentStatus{ ControllerName: v1alpha2.GatewayController(statusMgr.gatewayControllerName), diff --git a/pkg/handler/https.go b/pkg/handler/https.go index 868680fd..913b6341 100644 --- a/pkg/handler/https.go +++ b/pkg/handler/https.go @@ -232,7 +232,7 @@ func (handler HTTPS) enableSSLPassthrough(h haproxy.HAProxy) (err error) { }), h.BackendSwitchingRuleCreate(h.FrontSSL, models.BackendSwitchingRule{ Index: utils.PtrInt64(0), - Name: fmt.Sprintf("%%[var(txn.sni_match),field(1,.)]"), + Name: "%[var(txn.sni_match),field(1,.)]", }), handler.toggleSSLPassthrough(true, h)) return errors.Result() diff --git a/pkg/handler/tcp-services.go b/pkg/handler/tcp-services.go index 9e538f01..474e82b7 100644 --- a/pkg/handler/tcp-services.go +++ b/pkg/handler/tcp-services.go @@ -40,7 +40,7 @@ func (handler TCPServices) Update(k store.K8s, h haproxy.HAProxy, a annotations. if port == "log-format-tcp" { continue } - frontendName := fmt.Sprintf("tcp-%s", port) + frontendName := "tcp-" + port p, err = handler.parseTCPService(k, tcpSvcAnn) if err != nil { logger.Error(err) diff --git a/pkg/haproxy/api/backend.go b/pkg/haproxy/api/backend.go index e011c76e..c29b479c 100644 --- a/pkg/haproxy/api/backend.go +++ b/pkg/haproxy/api/backend.go @@ -1,7 +1,7 @@ package api import ( - "fmt" + "errors" "github.com/haproxytech/client-native/v5/models" "github.com/haproxytech/config-parser/v5/types" @@ -197,7 +197,7 @@ func (c *clientNative) BackendSwitchingRuleDeleteAll(frontend string) (err error if err != nil { return } - for i := 0; i < len(switchingRules); i++ { + for range len(switchingRules) { if err = configuration.DeleteBackendSwitchingRule(0, frontend, c.activeTransaction, 0); err != nil { break } @@ -232,7 +232,7 @@ func (c *clientNative) BackendServersGet(backendName string) (models.Servers, er func (c *clientNative) RefreshBackends() (deleted []string, err error) { backends, errAPI := c.BackendsGet() if errAPI != nil { - err = fmt.Errorf("unable to get configured backends") + err = errors.New("unable to get configured backends") return } for _, backend := range backends { diff --git a/pkg/haproxy/api/runtime.go b/pkg/haproxy/api/runtime.go index 0dca51ce..61269fcf 100644 --- a/pkg/haproxy/api/runtime.go +++ b/pkg/haproxy/api/runtime.go @@ -102,7 +102,7 @@ func (c *clientNative) runRaw(runtime runtime.Runtime, sb strings.Builder, backe pmm.UpdateRuntimeMetrics(metrics.ObjectServer, err) return err } - for i := 0; i < len(result); i++ { + for i := range len(result) { if len(result[i]) > 5 { switch result[i][1:5] { case "[3]:", "[2]:", "[1]:", "[0]:": @@ -138,7 +138,7 @@ func (c *clientNative) SetMapContent(mapFile string, payload []string) error { err = fmt.Errorf("error getting map path: %w", err) return err } - for i := 0; i < len(payload); i++ { + for i := range len(payload) { _, err = runtime.ExecuteRaw(fmt.Sprintf("add map @%s %s <<\n%s\n", mapVer, mapPath, payload[i])) pmm.UpdateRuntimeMetrics(metrics.ObjectMap, err) if err != nil { diff --git a/pkg/haproxy/certs/main.go b/pkg/haproxy/certs/main.go index cde30bb9..76094de5 100644 --- a/pkg/haproxy/certs/main.go +++ b/pkg/haproxy/certs/main.go @@ -73,16 +73,16 @@ type SecretCtx struct { func New(envParam Env) (Certificates, error) { //nolint:ireturn env = envParam if env.FrontendDir == "" { - return nil, fmt.Errorf("empty name for Frontend Cert Directory") + return nil, errors.New("empty name for Frontend Cert Directory") } if env.BackendDir == "" { - return nil, fmt.Errorf("empty name for Backend Cert Directory") + return nil, errors.New("empty name for Backend Cert Directory") } if env.CaDir == "" { - return nil, fmt.Errorf("empty name for CA Cert Directory") + return nil, errors.New("empty name for CA Cert Directory") } if env.TCPCRDir == "" { - return nil, fmt.Errorf("empty name for TCP Cert Directory") + return nil, errors.New("empty name for TCP Cert Directory") } return &certs{ frontend: make(map[string]*cert), @@ -227,7 +227,7 @@ func writeSecret(secret *store.Secret, c *cert, privateKeyNull bool) (err error) if !crtOk { return fmt.Errorf("certificate missing in %s/%s", secret.Namespace, secret.Name) } - c.path = fmt.Sprintf("%s.pem", c.path) + c.path += ".pem" return writeCert(c.path, []byte(""), crtValue) } for _, k := range []string{"tls", "rsa", "ecdsa", "dsa"} { @@ -235,7 +235,7 @@ func writeSecret(secret *store.Secret, c *cert, privateKeyNull bool) (err error) crtValue, crtOk = secret.Data[k+".crt"] if keyOk && crtOk { pemOk = true - certPath = fmt.Sprintf("%s.pem", c.path) + certPath = c.path + ".pem" if k != "tls" { // HAProxy "cert bundle" certPath = fmt.Sprintf("%s.%s", certPath, k) diff --git a/pkg/haproxy/env/main.go b/pkg/haproxy/env/main.go index a04efc61..5adf48fe 100644 --- a/pkg/haproxy/env/main.go +++ b/pkg/haproxy/env/main.go @@ -15,6 +15,7 @@ package env import ( + "errors" "fmt" "os" "path/filepath" @@ -62,7 +63,7 @@ func (env *Env) Init(osArgs utils.OSArgs) (err error) { } for _, dir := range []string{env.CfgDir, env.RuntimeDir, env.StateDir} { if dir == "" { - return fmt.Errorf("failed to init controller config: missing config directories") + return errors.New("failed to init controller config: missing config directories") } } // Binary and main files diff --git a/pkg/haproxy/maps/main.go b/pkg/haproxy/maps/main.go index d19de9b5..68c86fc5 100644 --- a/pkg/haproxy/maps/main.go +++ b/pkg/haproxy/maps/main.go @@ -16,7 +16,6 @@ package maps import ( "errors" - "fmt" "hash/fnv" "os" "path" @@ -82,7 +81,7 @@ func (mf *mapFile) getContent() (result []string, hash uint64) { func New(dir string, persistentMaps []Name) (Maps, error) { //nolint:ireturn if dir == "" { - return nil, fmt.Errorf("empty name for map directory") + return nil, errors.New("empty name for map directory") } mapDir = dir var maps mapFiles = make(map[Name]*mapFile, len(persistentMaps)) diff --git a/pkg/haproxy/process/direct-control.go b/pkg/haproxy/process/direct-control.go index 1632cee9..b277ffec 100644 --- a/pkg/haproxy/process/direct-control.go +++ b/pkg/haproxy/process/direct-control.go @@ -29,7 +29,7 @@ func (d *directControl) Service(action string) (err error) { // hold information about a running Master HAproxy process process, processErr := haproxyProcess(d.Env.PIDFile) - masterSocketArg := fmt.Sprintf("%s,level,admin", d.Env.MasterSocket) + masterSocketArg := d.Env.MasterSocket + ",level,admin" //nolint:gosec //checks on HAProxyBinary should be done in configuration module. switch action { diff --git a/pkg/haproxy/rules/main.go b/pkg/haproxy/rules/main.go index 6eceee9f..693360e5 100644 --- a/pkg/haproxy/rules/main.go +++ b/pkg/haproxy/rules/main.go @@ -2,6 +2,7 @@ package rules import ( "encoding/json" + "errors" "fmt" "github.com/haproxytech/client-native/v5/models" @@ -73,7 +74,7 @@ func (rules *List) Add(rule Rule) { func (r SectionRules) AddRule(frontend string, rule Rule, ingressRule bool) error { if rule == nil || frontend == "" { - return fmt.Errorf("invalid params") + return errors.New("invalid params") } // Create frontend ruleSet ftRuleSet, ok := r[frontend] diff --git a/pkg/haproxy/rules/reqAcceptContent.go b/pkg/haproxy/rules/reqAcceptContent.go index ec66bf11..1fa2b2b7 100644 --- a/pkg/haproxy/rules/reqAcceptContent.go +++ b/pkg/haproxy/rules/reqAcceptContent.go @@ -1,7 +1,7 @@ package rules import ( - "fmt" + "errors" "github.com/haproxytech/client-native/v5/models" @@ -17,7 +17,7 @@ func (r ReqAcceptContent) GetType() Type { func (r ReqAcceptContent) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error { if frontend.Mode == "http" { - return fmt.Errorf("tcp accept-content rule is only available in TCP frontends") + return errors.New("tcp accept-content rule is only available in TCP frontends") } tcpRule := models.TCPRequestRule{ Index: utils.PtrInt64(0), diff --git a/pkg/haproxy/rules/reqInspectDelay.go b/pkg/haproxy/rules/reqInspectDelay.go index e72f1bd4..b388c633 100644 --- a/pkg/haproxy/rules/reqInspectDelay.go +++ b/pkg/haproxy/rules/reqInspectDelay.go @@ -1,7 +1,7 @@ package rules import ( - "fmt" + "errors" "github.com/haproxytech/client-native/v5/models" @@ -19,7 +19,7 @@ func (r ReqInspectDelay) GetType() Type { func (r ReqInspectDelay) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error { if frontend.Mode == "http" { - return fmt.Errorf("tcp inspect-delay rule is only available in TCP frontends") + return errors.New("tcp inspect-delay rule is only available in TCP frontends") } tcpRule := models.TCPRequestRule{ Type: "inspect-delay", diff --git a/pkg/haproxy/rules/reqPathRewrite.go b/pkg/haproxy/rules/reqPathRewrite.go index bfac1a49..cc7a8ac6 100644 --- a/pkg/haproxy/rules/reqPathRewrite.go +++ b/pkg/haproxy/rules/reqPathRewrite.go @@ -1,7 +1,7 @@ package rules import ( - "fmt" + "errors" "github.com/haproxytech/client-native/v5/models" @@ -20,7 +20,7 @@ func (r ReqPathRewrite) GetType() Type { func (r ReqPathRewrite) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error { if frontend.Mode == "tcp" { - return fmt.Errorf("SSL redirect cannot be configured in TCP mode") + return errors.New("SSL redirect cannot be configured in TCP mode") } httpRule := models.HTTPRequestRule{ Index: utils.PtrInt64(0), diff --git a/pkg/haproxy/rules/reqRatelimit.go b/pkg/haproxy/rules/reqRatelimit.go index ea71c435..f957b2bb 100644 --- a/pkg/haproxy/rules/reqRatelimit.go +++ b/pkg/haproxy/rules/reqRatelimit.go @@ -1,6 +1,7 @@ package rules import ( + "errors" "fmt" "github.com/haproxytech/client-native/v5/models" @@ -21,7 +22,7 @@ func (r ReqRateLimit) GetType() Type { func (r ReqRateLimit) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error { if frontend.Mode == "tcp" { - return fmt.Errorf("request Track cannot be configured in TCP mode") + return errors.New("request Track cannot be configured in TCP mode") } httpRule := models.HTTPRequestRule{ Index: utils.PtrInt64(0), diff --git a/pkg/haproxy/rules/reqRequestRedirect.go b/pkg/haproxy/rules/reqRequestRedirect.go index a029cc32..c8edfca1 100644 --- a/pkg/haproxy/rules/reqRequestRedirect.go +++ b/pkg/haproxy/rules/reqRequestRedirect.go @@ -1,6 +1,7 @@ package rules import ( + "errors" "fmt" "github.com/haproxytech/client-native/v5/models" @@ -23,7 +24,7 @@ func (r RequestRedirect) GetType() Type { func (r RequestRedirect) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error { if frontend.Mode == "tcp" { - return fmt.Errorf("request redirection cannot be configured in TCP mode") + return errors.New("request redirection cannot be configured in TCP mode") } var rule string if r.SSLRedirect { diff --git a/pkg/haproxy/rules/reqRequestRedirectQuic.go b/pkg/haproxy/rules/reqRequestRedirectQuic.go index ec6095f4..1e5ed61a 100644 --- a/pkg/haproxy/rules/reqRequestRedirectQuic.go +++ b/pkg/haproxy/rules/reqRequestRedirectQuic.go @@ -1,7 +1,7 @@ package rules import ( - "fmt" + "errors" "github.com/haproxytech/client-native/v5/models" @@ -17,7 +17,7 @@ func (r RequestRedirectQuic) GetType() Type { func (r RequestRedirectQuic) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error { if frontend.Mode == "tcp" { - return fmt.Errorf("request redirection cannot be configured in TCP mode") + return errors.New("request redirection cannot be configured in TCP mode") } httpRule := models.HTTPRequestRule{ diff --git a/pkg/haproxy/rules/reqTrack.go b/pkg/haproxy/rules/reqTrack.go index dac7bd56..eb841830 100644 --- a/pkg/haproxy/rules/reqTrack.go +++ b/pkg/haproxy/rules/reqTrack.go @@ -1,6 +1,7 @@ package rules import ( + "errors" "fmt" "github.com/haproxytech/client-native/v5/models" @@ -22,7 +23,7 @@ func (r ReqTrack) GetType() Type { func (r ReqTrack) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error { if frontend.Mode == "tcp" { - return fmt.Errorf("request Track cannot be configured in TCP mode") + return errors.New("request Track cannot be configured in TCP mode") } // Create tracking table. diff --git a/pkg/haproxy/rules/setHdr.go b/pkg/haproxy/rules/setHdr.go index 1c42e8fa..8e3d658c 100644 --- a/pkg/haproxy/rules/setHdr.go +++ b/pkg/haproxy/rules/setHdr.go @@ -1,7 +1,7 @@ package rules import ( - "fmt" + "errors" "github.com/haproxytech/client-native/v5/models" @@ -31,7 +31,7 @@ func (r SetHdr) GetType() Type { func (r SetHdr) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error { if frontend.Mode == "tcp" { - return fmt.Errorf("HTTP headers cannot be set in TCP mode") + return errors.New("HTTP headers cannot be set in TCP mode") } // REQ_FORWARDED_PROTO if r.ForwardedProto { diff --git a/pkg/job/crd-check.go b/pkg/job/crd-check.go index d096a2bb..e864170e 100644 --- a/pkg/job/crd-check.go +++ b/pkg/job/crd-check.go @@ -79,7 +79,7 @@ func CRDRefresh(log utils.Logger, osArgs utils.OSArgs) error { needUpgrade = true } cnNew := crd.ObjectMeta.Annotations["haproxy.org/client-native"] - vK8s, err := semver.NewVersion(cnInK8s) //nolint:govet + vK8s, err := semver.NewVersion(cnInK8s) if err != nil { needUpgrade = true log.Error(err.Error()) diff --git a/pkg/k8s/main.go b/pkg/k8s/main.go index eda612d5..ec35336a 100644 --- a/pkg/k8s/main.go +++ b/pkg/k8s/main.go @@ -65,7 +65,7 @@ type K8s interface { // and a method to process the update of a CR type CR interface { GetKind() string - GetInformer(chan k8ssync.SyncDataEvent, crinformers.SharedInformerFactory) cache.SharedIndexInformer + GetInformer(chan k8ssync.SyncDataEvent, crinformers.SharedInformerFactory) cache.SharedIndexInformer //nolint:inamedparam } // k8s is structure with all data required to synchronize with k8s diff --git a/pkg/route/route.go b/pkg/route/route.go index 2caeaf12..97d1d9da 100644 --- a/pkg/route/route.go +++ b/pkg/route/route.go @@ -15,6 +15,7 @@ package route import ( + "errors" "fmt" "strings" @@ -55,7 +56,7 @@ type Route struct { // AddHostPathRoute adds Host/Path ingress route to haproxy Map files used for backend switching. func AddHostPathRoute(route Route, mapFiles maps.Maps) error { if route.BackendName == "" { - return fmt.Errorf("backendName missing") + return errors.New("backendName missing") } // Wildcard host if route.Host != "" && route.Host[0] == '*' { diff --git a/pkg/service/endpoints.go b/pkg/service/endpoints.go index 596ddad1..32c57623 100644 --- a/pkg/service/endpoints.go +++ b/pkg/service/endpoints.go @@ -15,7 +15,9 @@ package service import ( + "errors" "fmt" + "strconv" "strings" "github.com/haproxytech/client-native/v5/models" @@ -170,7 +172,7 @@ func (s *Service) getRuntimeBackend(k8s store.K8s) (backend *store.RuntimeBacken if s.resource.DNS != "" { return s.getExternalNameEndpoints() } - return nil, fmt.Errorf("no available endpoints") + return nil, errors.New("no available endpoints") } svcPort := s.path.SvcPortResolved if svcPort != nil && backends[svcPort.Name] != nil { @@ -193,7 +195,7 @@ func (s *Service) getExternalNameEndpoints() (endpoints *store.RuntimeBackend, e if port == 0 { ingressPort := s.path.SvcPortString if s.path.SvcPortInt != 0 { - ingressPort = fmt.Sprintf("%d", s.path.SvcPortInt) + ingressPort = strconv.FormatInt(s.path.SvcPortInt, 10) } return nil, fmt.Errorf("service '%s': service port '%s' not found", s.resource.Name, ingressPort) }