Browse Source

use fmt.Sprint for string to int conversion

pull/5730/head v0.33.9
Anton Kaliaev 4 years ago
parent
commit
1baf670c60
3 changed files with 4 additions and 4 deletions
  1. +2
    -2
      libs/cmap/cmap_test.go
  2. +1
    -1
      libs/pubsub/pubsub_test.go
  3. +1
    -1
      p2p/upnp/upnp.go

+ 2
- 2
libs/cmap/cmap_test.go View File

@ -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))
}
}

+ 1
- 1
libs/pubsub/pubsub_test.go View File

@ -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)}},
)
}
}


+ 1
- 1
p2p/upnp/upnp.go View File

@ -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


Loading…
Cancel
Save