Skip to content

Commit

Permalink
Merge pull request #335 from testwill/string
Browse files Browse the repository at this point in the history
chore:  use xxx.String() instead of string(xxx.Bytes())
  • Loading branch information
rcoreilly authored Dec 12, 2023
2 parents 2dc64b7 + bc9d28b commit a5b96e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bind/printer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl 1
impl 2
`

str := string(out.Bytes())
str := out.String()
if !reflect.DeepEqual(str, want) {
t.Fatalf("error:\nwant=%q\ngot =%q\n", want, str)
}
Expand Down
6 changes: 3 additions & 3 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestGovet(t *testing.T) {
cmd.Stderr = buf
err := cmd.Run()
if err != nil {
t.Fatalf("error running %s:\n%s\n%v", "go vet", string(buf.Bytes()), err)
t.Fatalf("error running %s:\n%s\n%v", "go vet", buf.String(), err)
}
}

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

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

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

Expand Down

0 comments on commit a5b96e6

Please sign in to comment.