1
0
mirror of https://github.com/danog/gojekyll.git synced 2025-01-22 23:11:26 +01:00

TIL io.WriteString

This commit is contained in:
Oliver Steele 2017-07-15 21:25:35 -04:00
parent 59316fde63
commit 50c7d4b28e
4 changed files with 5 additions and 4 deletions

View File

@ -83,6 +83,6 @@ func (p *Pipeline) WriteSass(w io.Writer, b []byte) error {
if err != nil {
return err
}
_, err = w.Write([]byte(s))
_, err = io.WriteString(w, s)
return err
}

View File

@ -2,6 +2,7 @@ package server
import (
"bytes"
"io"
"testing"
"github.com/stretchr/testify/require"
@ -17,7 +18,7 @@ func TestTagInjector(t *testing.T) {
for _, test := range tests {
out := new(bytes.Buffer)
w := TagInjector{out, []byte(":insertion:")}
_, err := w.Write([]byte(test.in))
_, err := io.WriteString(w, test.in)
require.NoError(t, err)
require.Equal(t, test.out, out.String())
}

View File

@ -28,7 +28,7 @@ outer:
}
case html.TextToken:
if body {
s := (string(z.Text()))
s := string(z.Text())
_, err := buf.WriteString(fn(s))
if err != nil {
panic(err)

View File

@ -56,7 +56,7 @@ func TestVisitCreatedFile(t *testing.T) {
err = f.Close()
require.NoError(t, err)
err = VisitCreatedFile(f.Name(), func(w io.Writer) error {
_, e := w.Write([]byte("test"))
_, e := io.WriteString(w, "test")
return e
})
require.NoError(t, err)