Replace *bytes.Buffer with io.Writer in rendering

Found via github.com/mvdan/interfacer.
This commit is contained in:
Daniel Martí
2016-01-03 12:53:45 +01:00
committed by Bjørn Erik Pedersen
parent 4c596483e1
commit 7c5a1fd16b
2 changed files with 4 additions and 5 deletions

View File

@@ -1691,14 +1691,14 @@ func (s *Site) renderAndWritePage(name string, dest string, d interface{}, layou
return err
}
func (s *Site) render(name string, d interface{}, renderBuffer *bytes.Buffer, layouts ...string) error {
func (s *Site) render(name string, d interface{}, w io.Writer, layouts ...string) error {
layout, found := s.findFirstLayout(layouts...)
if found == false {
jww.WARN.Printf("Unable to locate layout for %s: %s\n", name, layouts)
return nil
}
if err := s.renderThing(d, layout, renderBuffer); err != nil {
if err := s.renderThing(d, layout, w); err != nil {
// Behavior here should be dependent on if running in server or watch mode.
distinctErrorLogger.Printf("Error while rendering %s: %v", name, err)
if !s.Running() {