Skip to content

Commit

Permalink
chore: unnecessary use of fmt.Sprintf
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <[email protected]>
  • Loading branch information
testwill committed Jul 25, 2023
1 parent 7af45ce commit f628d3c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ func (c *peerGroupResolver) Resolve(peers []fab.Peer) (PeerGroup, error) {
for i, grp := range peerGroups {
s += fmt.Sprintf("%d - %+v", i, grp)
if i+1 < len(peerGroups) {
s += fmt.Sprintf(" OR ")
s += " OR "
}
}
s += fmt.Sprintf(" ")
s += " "
}
logger.Debugf(s)
}
Expand All @@ -107,10 +107,10 @@ func (c *peerGroupResolver) getPeerGroups(peerRetriever MSPPeerRetriever) ([]Pee
for i, g := range mspGroups {
s += fmt.Sprintf("%+v", g)
if i+1 < len(mspGroups) {
s += fmt.Sprintf(" OR ")
s += " OR "
}
}
s += fmt.Sprintf(" ")
s += " "
logger.Debugf(s)
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/common/errors/multi/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ SPDX-License-Identifier: Apache-2.0
package multi

import (
"fmt"
"strings"
)

Expand Down Expand Up @@ -71,7 +70,7 @@ func (errs Errors) Error() string {
return errs[0].Error()
}

errors := []string{fmt.Sprint("Multiple errors occurred:")}
errors := []string{"Multiple errors occurred:"}
for _, err := range errs {
errors = append(errors, err.Error())
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/fab/resource/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package resource

import (
"bytes"
"fmt"
"io/ioutil"
"path/filepath"
"testing"
Expand Down Expand Up @@ -59,7 +58,7 @@ func TestCreateChannel(t *testing.T) {

// Setup mock orderer
verifyBroadcast := make(chan *fab.SignedEnvelope)
orderer := mocks.NewMockOrderer(fmt.Sprintf("0.0.0.0:1234"), verifyBroadcast)
orderer := mocks.NewMockOrderer("0.0.0.0:1234", verifyBroadcast)

// Create channel without envelope
reqCtx, cancel := contextImpl.NewRequest(ctx, contextImpl.WithTimeout(10*time.Second))
Expand Down

0 comments on commit f628d3c

Please sign in to comment.