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,9 +2,9 @@ package reddit
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// postAndCommentService handles communication with the post and comment
|
||||
@@ -137,7 +137,7 @@ func (s *postAndCommentService) vote(ctx context.Context, id string, vote vote)
|
||||
|
||||
form := url.Values{}
|
||||
form.Set("id", id)
|
||||
form.Set("dir", fmt.Sprint(vote))
|
||||
form.Set("dir", strconv.Itoa(int(vote)))
|
||||
form.Set("rank", "10")
|
||||
|
||||
req, err := s.client.NewRequest(http.MethodPost, path, form)
|
||||
|
||||
Reference in New Issue
Block a user