From 96109ad68f65d2c9a4633629d703180dcdba2cc2 Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Mon, 18 Sep 2023 14:13:47 +0800 Subject: [PATCH] chore: unnecessary use of fmt.Sprintf Signed-off-by: guoguangwu --- modules/dns-helper/errors.go | 2 +- modules/docker/inspect_test.go | 2 +- modules/shell/command_test.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/dns-helper/errors.go b/modules/dns-helper/errors.go index 7d0e80b5b..56e575242 100644 --- a/modules/dns-helper/errors.go +++ b/modules/dns-helper/errors.go @@ -6,7 +6,7 @@ import "fmt" type NoResolversError struct{} func (err NoResolversError) Error() string { - return fmt.Sprintf("No resolvers set for DNSLookupE call") + return "No resolvers set for DNSLookupE call" } // QueryTypeError is an error that occurs if the DNS query type is not supported diff --git a/modules/docker/inspect_test.go b/modules/docker/inspect_test.go index e32a43136..33fdac88e 100644 --- a/modules/docker/inspect_test.go +++ b/modules/docker/inspect_test.go @@ -63,7 +63,7 @@ func TestInspectWithRandomExposedPort(t *testing.T) { var unexpectedPort uint16 = 1234 options := &RunOptions{ Detach: true, - OtherOptions: []string{fmt.Sprintf("-P")}, + OtherOptions: []string{"-P"}, } id := RunAndGetID(t, dockerInspectTestImage, options) diff --git a/modules/shell/command_test.go b/modules/shell/command_test.go index 5f5407116..8066042f0 100644 --- a/modules/shell/command_test.go +++ b/modules/shell/command_test.go @@ -121,13 +121,13 @@ func TestRunCommandWithHugeLineOutput(t *testing.T) { t.Parallel() // generate a ~100KB line - bashCode := fmt.Sprintf(` + bashCode := ` for i in {0..35000} do echo -n foo done echo -`) +` cmd := Command{ Command: "bash",