Replace fmt.Sprint with strconv.Itoa, specify slice capacity
Uber's Go style guide outlines a slight performance benefit when using strconv over fmt: https://github.com/uber-go/guide/blob/dc025303c14891f54d1847396379548773e6123e/style.md#prefer-strconv-over-fmt Also specifiying slice capacity when it is known beforehand: https://github.com/uber-go/guide/blob/dc025303c14891f54d1847396379548773e6123e/style.md#specifying-slice-capacity Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
+2
-1
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// GoldService handles communication with the gold
|
||||
@@ -37,7 +38,7 @@ func (s *GoldService) Give(ctx context.Context, username string, months int) (*R
|
||||
path := fmt.Sprintf("api/v1/gold/give/%s", username)
|
||||
|
||||
form := url.Values{}
|
||||
form.Set("months", fmt.Sprint(months))
|
||||
form.Set("months", strconv.Itoa(months))
|
||||
|
||||
req, err := s.client.NewRequest(http.MethodPost, path, form)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user