Skip to content

Commit

Permalink
Merge pull request #122 from instana/fix_upcoming_go_vet_errors
Browse files Browse the repository at this point in the history
Replace int-to-string casts with conversion
  • Loading branch information
Andrew Slotin authored May 19, 2020
2 parents a86d29d + 52822d3 commit 66f9f11
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions autoprofile/internal/pprof/profile/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

package profile

import "errors"
import (
"errors"
"fmt"
)

type buffer struct {
field int
Expand Down Expand Up @@ -232,7 +235,7 @@ func decodeField(b *buffer, data []byte) ([]byte, error) {
b.u64 = uint64(le32(data[:4]))
data = data[4:]
default:
return nil, errors.New("unknown type: " + string(b.typ))
return nil, fmt.Errorf("unknown type: %d", b.typ)
}

return data, nil
Expand Down
2 changes: 1 addition & 1 deletion example/autoprofile/demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func leakMemory(duration int, size int) {
for j := 0; j < duration; j++ {
go func() {
for i := 0; i < size; i++ {
mem = append(mem, string(i))
mem = append(mem, strconv.Itoa(i))
}
}()

Expand Down

0 comments on commit 66f9f11

Please sign in to comment.