Skip to content

Commit

Permalink
use fmt.Sprint for string to int conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
melekes committed Nov 16, 2020
1 parent b59ecd6 commit 1baf670
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libs/cmap/cmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ func TestContains(t *testing.T) {
func BenchmarkCMapHas(b *testing.B) {
m := NewCMap()
for i := 0; i < 1000; i++ {
m.Set(string(i), i)
m.Set(fmt.Sprint(i), i)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
m.Has(string(i))
m.Has(fmt.Sprint(i))
}
}
2 changes: 1 addition & 1 deletion libs/pubsub/pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func benchmarkNClients(n int, b *testing.B) {
s.PublishWithEvents(
ctx,
"Gamora",
map[string][]string{"abci.Account.Owner": {"Ivan"}, "abci.Invoices.Number": {string(i)}},
map[string][]string{"abci.Account.Owner": {"Ivan"}, "abci.Invoices.Number": {fmt.Sprint(i)}},
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion p2p/upnp/upnp.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func getServiceURL(rootURL string) (url, urnDomain string, err error) {
defer r.Body.Close() // nolint: errcheck

if r.StatusCode >= 400 {
err = errors.New(string(r.StatusCode))
err = errors.New(fmt.Sprint(r.StatusCode))
return
}
var root Root
Expand Down

0 comments on commit 1baf670

Please sign in to comment.