impl ledger.Files.TempGet/SetLastNLines

This commit is contained in:
bel
2023-10-29 09:14:10 -06:00
parent 569e50b162
commit a623dcc195

View File

@@ -3,7 +3,6 @@ package ledger
import ( import (
"bufio" "bufio"
"bytes" "bytes"
"errors"
"fmt" "fmt"
"io" "io"
"io/fs" "io/fs"
@@ -56,7 +55,7 @@ func (files Files) TempSetLastNLines(n int, lines []string) error {
fmt.Fprintln(w, lines[i]) fmt.Fprintln(w, lines[i])
} }
return errors.New(w.Name()) return os.Rename(w.Name(), p)
} }
func peekLastNLines(w io.Writer, r *bufio.Reader, n int) ([]string, error) { func peekLastNLines(w io.Writer, r *bufio.Reader, n int) ([]string, error) {