1
0
mirror of https://github.com/danog/gojekyll.git synced 2025-01-22 20:51:24 +01:00
gojekyll/pages/static_file.go
Oliver Steele a48087bd9b Coverage
2017-07-04 17:36:06 -04:00

26 lines
475 B
Go

package pages
import (
"io"
"os"
)
// StaticFile is a static file.
type StaticFile struct {
file
}
// Static is in the File interface.
func (p *StaticFile) Static() bool { return true }
// Write returns a bool indicating that the page is a static page.
func (p *StaticFile) Write(w io.Writer, _ RenderingContext) error {
in, err := os.Open(p.filename)
if err != nil {
return err
}
defer in.Close() // nolint: errcheck, gas
_, err = io.Copy(w, in)
return err
}