Skip to content

Commit 66f9f11

Browse files
author
Andrew Slotin
authored
Merge pull request #122 from instana/fix_upcoming_go_vet_errors
Replace int-to-string casts with conversion
2 parents a86d29d + 52822d3 commit 66f9f11

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

autoprofile/internal/pprof/profile/proto.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121

2222
package profile
2323

24-
import "errors"
24+
import (
25+
"errors"
26+
"fmt"
27+
)
2528

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

238241
return data, nil

example/autoprofile/demo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func leakMemory(duration int, size int) {
4646
for j := 0; j < duration; j++ {
4747
go func() {
4848
for i := 0; i < size; i++ {
49-
mem = append(mem, string(i))
49+
mem = append(mem, strconv.Itoa(i))
5050
}
5151
}()
5252

0 commit comments

Comments
 (0)