From 22059c399ec60dc7cf857756aff70c86b6ffaf33 Mon Sep 17 00:00:00 2001 From: KentHsu Date: Wed, 24 Jul 2024 11:12:02 +0800 Subject: [PATCH] fix perfsprint linter error Signed-off-by: KentHsu --- cmd/dashboard.go | 3 ++- pkg/standalone/invoke.go | 2 +- pkg/standalone/publish.go | 2 +- pkg/standalone/stop.go | 5 +++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cmd/dashboard.go b/cmd/dashboard.go index d75be1b42..b3417ff17 100644 --- a/cmd/dashboard.go +++ b/cmd/dashboard.go @@ -18,6 +18,7 @@ import ( "net" "os" "os/signal" + "strconv" "github.com/pkg/browser" "github.com/spf13/cobra" @@ -180,7 +181,7 @@ dapr dashboard -k -p 0 }() // url for dashboard after port forwarding. - webURL := fmt.Sprintf("http://%s", net.JoinHostPort(dashboardHost, fmt.Sprint(portForward.LocalPort))) //nolint: perfsprint + webURL := fmt.Sprintf("http://%s", net.JoinHostPort(dashboardHost, strconv.Itoa(portForward.LocalPort))) print.InfoStatusEvent(os.Stdout, fmt.Sprintf("Dapr dashboard found in namespace:\t%s", foundNamespace)) print.InfoStatusEvent(os.Stdout, fmt.Sprintf("Dapr dashboard available at:\t%s\n", webURL)) diff --git a/pkg/standalone/invoke.go b/pkg/standalone/invoke.go index 597b2730b..ba34fd4e5 100644 --- a/pkg/standalone/invoke.go +++ b/pkg/standalone/invoke.go @@ -64,7 +64,7 @@ func (s *Standalone) Invoke(appID, method string, data []byte, verb string, path } func makeEndpoint(lo ListOutput, method string) string { - return fmt.Sprintf("http://127.0.0.1:%s/v%s/invoke/%s/method/%s", fmt.Sprintf("%v", lo.HTTPPort), api.RuntimeAPIVersion, lo.AppID, method) //nolint: perfsprint + return fmt.Sprintf("http://127.0.0.1:%d/v%s/invoke/%s/method/%s", lo.HTTPPort, api.RuntimeAPIVersion, lo.AppID, method) } func handleResponse(response *http.Response) (string, error) { diff --git a/pkg/standalone/publish.go b/pkg/standalone/publish.go index 30ae646fe..7e5d04c44 100644 --- a/pkg/standalone/publish.go +++ b/pkg/standalone/publish.go @@ -62,7 +62,7 @@ func (s *Standalone) Publish(publishAppID, pubsubName, topic string, payload []b }, } } else { - url = fmt.Sprintf("http://localhost:%s/v%s/publish/%s/%s%s", fmt.Sprintf("%v", instance.HTTPPort), api.RuntimeAPIVersion, pubsubName, topic, queryParams) //nolint: perfsprint + url = fmt.Sprintf("http://localhost:%d/v%s/publish/%s/%s%s", instance.HTTPPort, api.RuntimeAPIVersion, pubsubName, topic, queryParams) } contentType := "application/json" diff --git a/pkg/standalone/stop.go b/pkg/standalone/stop.go index 78a75a968..a4497ed23 100644 --- a/pkg/standalone/stop.go +++ b/pkg/standalone/stop.go @@ -18,6 +18,7 @@ package standalone import ( "fmt" + "strconv" "syscall" "github.com/dapr/cli/utils" @@ -31,10 +32,10 @@ func Stop(appID string, cliPIDToNoOfApps map[int]int, apps []ListOutput) error { // Kill the Daprd process if Daprd was started without CLI, otherwise // kill the CLI process which also kills the associated Daprd process. if a.CliPID == 0 || cliPIDToNoOfApps[a.CliPID] > 1 { - pid = fmt.Sprintf("%v", a.DaprdPID) //nolint: perfsprint + pid = strconv.Itoa(a.DaprdPID) cliPIDToNoOfApps[a.CliPID]-- } else { - pid = fmt.Sprintf("%v", a.CliPID) //nolint: perfsprint + pid = strconv.Itoa(a.CliPID) } _, err := utils.RunCmdAndWait("kill", pid)