avoiding unnecessary type conversions

This commit is contained in:
Alexandr Bruyako 2019-06-30 23:58:00 +03:00
parent 8b22fe29cf
commit 76d1866444
2 changed files with 2 additions and 2 deletions

View File

@ -129,7 +129,7 @@ func (t *Table) Write(w io.Writer) error {
return err return err
} }
row = append(row, string(buf.Bytes())) row = append(row, buf.String())
buf.Reset() buf.Reset()
} }
lines = append(lines, row) lines = append(lines, row)

View File

@ -154,7 +154,7 @@ foo 2018-08-19 22:22:22 xxx other /home/user/other
} }
want := strings.TrimLeft(test.output, "\n") want := strings.TrimLeft(test.output, "\n")
if string(buf.Bytes()) != want { if buf.String() != want {
t.Errorf("wrong output\n---- want ---\n%s\n---- got ---\n%s\n-------\n", want, buf.Bytes()) t.Errorf("wrong output\n---- want ---\n%s\n---- got ---\n%s\n-------\n", want, buf.Bytes())
} }
}) })