Skip to content

Commit a5b96e6

Browse files
authored
Merge pull request #335 from testwill/string
chore: use xxx.String() instead of string(xxx.Bytes())
2 parents 2dc64b7 + bc9d28b commit a5b96e6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

bind/printer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl 1
4949
impl 2
5050
`
5151

52-
str := string(out.Bytes())
52+
str := out.String()
5353
if !reflect.DeepEqual(str, want) {
5454
t.Fatalf("error:\nwant=%q\ngot =%q\n", want, str)
5555
}

main_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestGovet(t *testing.T) {
6666
cmd.Stderr = buf
6767
err := cmd.Run()
6868
if err != nil {
69-
t.Fatalf("error running %s:\n%s\n%v", "go vet", string(buf.Bytes()), err)
69+
t.Fatalf("error running %s:\n%s\n%v", "go vet", buf.String(), err)
7070
}
7171
}
7272

@@ -91,11 +91,11 @@ func TestGofmt(t *testing.T) {
9191

9292
err = cmd.Run()
9393
if err != nil {
94-
t.Fatalf("error running %s:\n%s\n%v", exe, string(buf.Bytes()), err)
94+
t.Fatalf("error running %s:\n%s\n%v", exe, buf.String(), err)
9595
}
9696

9797
if len(buf.Bytes()) != 0 {
98-
t.Errorf("some files were not gofmt'ed:\n%s\n", string(buf.Bytes()))
98+
t.Errorf("some files were not gofmt'ed:\n%s\n", buf.String())
9999
}
100100
}
101101

0 commit comments

Comments
 (0)