Make sure File is an io.WriterTo

This commit is contained in:
Sasha Koshka 2024-08-23 01:16:17 -04:00
parent 81bd635b09
commit 0ebf3ff4cc

View File

@ -13,6 +13,8 @@ type line any
type comment string
type entry struct { key string; value Value }
var _ io.WriterTo = new(File)
// File represents a config file. It preserves the order of the lines, as well
// as blank lines and comments.
type File struct {
@ -251,8 +253,8 @@ func (this *File) Diff (other *File) map[string] struct { } {
}
// WriteTo writes the data in this file to an io.Writer.
func (file *File) WriteTo (writer io.Writer) (n int64, err error) {
for _, lin := range file.lines {
func (this *File) WriteTo (writer io.Writer) (n int64, err error) {
for _, lin := range this.lines {
nint := 0
switch lin := lin.(type) {
case comment: