parent
6b9865c607
commit
880ea6dba8
1 changed files with 9 additions and 1 deletions
|
@ -63,6 +63,9 @@ const (
|
||||||
|
|
||||||
// Writer is the interface to render a template
|
// Writer is the interface to render a template
|
||||||
type Writer interface {
|
type Writer interface {
|
||||||
|
// Write renders the template.
|
||||||
|
// NOTE: Implementors must ensure that the content of the returned slice is not modified by the implementation
|
||||||
|
// after the return of this function.
|
||||||
Write(conf config.TemplateConfig) ([]byte, error)
|
Write(conf config.TemplateConfig) ([]byte, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +205,12 @@ func (t *Template) Write(conf config.TemplateConfig) ([]byte, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return outCmdBuf.Bytes(), nil
|
// make a copy to ensure that we are no longer modifying the content of the buffer
|
||||||
|
out := outCmdBuf.Bytes()
|
||||||
|
res := make([]byte, len(out))
|
||||||
|
copy(res, out)
|
||||||
|
|
||||||
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Loading…
Reference in a new issue