Skip to content

Commit

Permalink
Address perfsprint linter violations
Browse files Browse the repository at this point in the history
Use simple concatenation instead.

Signed-off-by: Tom Pantelis <[email protected]>
  • Loading branch information
tpantelis committed Nov 13, 2024
1 parent 33b7c94 commit d122dd3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions pkg/fake/basic_reactors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package fake_test

import (
"context"
"fmt"
"time"

. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -252,7 +251,7 @@ var _ = Describe("Watch", func() {
case watch.Added:
Expect(resource.MustToMeta(event.Object).GetName()).To(Equal(t.pod.Name))
default:
Fail(fmt.Sprintf("Received unexpected watch event: %s", resource.ToJSON(event)))
Fail("Received unexpected watch event: " + resource.ToJSON(event))
}
case <-time.After(1 * time.Second):
Fail("Did not receive expected watch event")
Expand All @@ -266,7 +265,7 @@ var _ = Describe("Watch", func() {

select {
case event := <-watcher.ResultChan():
Fail(fmt.Sprintf("Received unexpected watch event: %s", resource.ToJSON(event)))
Fail("Received unexpected watch event: " + resource.ToJSON(event))
case <-time.After(300 * time.Millisecond):
}
})
Expand Down
5 changes: 2 additions & 3 deletions pkg/resource/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"context"
"crypto/x509"
"encoding/base64"
"fmt"

"github.com/pkg/errors"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -91,7 +90,7 @@ func BuildRestConfigFromData(apiServer, apiServerToken, caData string, tls *rest
}

return &rest.Config{
Host: fmt.Sprintf("https://%s", apiServer),
Host: "https://" + apiServer,
TLSClientConfig: *tls,
BearerToken: apiServerToken,
}, nil
Expand All @@ -107,7 +106,7 @@ func BuildRestConfigFromFiles(apiServer, apiServerTokenFile, caFile string, tls
}

return &rest.Config{
Host: fmt.Sprintf("https://%s", apiServer),
Host: "https://" + apiServer,
TLSClientConfig: *tls,
BearerTokenFile: apiServerTokenFile,
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/syncer/broker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ func EnvironmentVariable(setting string) string {
}
}

panic(fmt.Sprintf("unknown Broker setting %s", setting))
panic("unknown Broker setting: " + setting)
}

func SecretPath(secretName string) string {
return fmt.Sprintf("/run/secrets/submariner.io/%s", secretName)
return "/run/secrets/submariner.io/" + secretName
}
2 changes: 1 addition & 1 deletion pkg/syncer/broker/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ var logger = log.Logger{Logger: logf.Log.WithName("BrokerSyncer")}
// NewSyncer creates a Syncer that performs bi-directional syncing of resources between a local source and a central broker.
func NewSyncer(config SyncerConfig) (*Syncer, error) { //nolint:gocritic // Minimal performance hit, we modify our copy
if len(config.ResourceConfigs) == 0 {
return nil, fmt.Errorf("no resources to sync")
return nil, errors.New("no resources to sync")
}

var err error
Expand Down
2 changes: 1 addition & 1 deletion pkg/watcher/resource_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func New(config *Config) (Interface, error) {
var err error

if len(config.ResourceConfigs) == 0 {
return nil, fmt.Errorf("no resources to watch")
return nil, errors.New("no resources to watch")
}

restMapper := config.RestMapper
Expand Down

0 comments on commit d122dd3

Please sign in to comment.