loginToTemplate/tape.go
2022-03-01 11:55:49 -05:00

15 lines
266 B
Go

package main
import "os"
// Tape represents an os.File that will re-write from the start on every Write call.
type Tape struct {
File *os.File
}
func (t *Tape) Write(p []byte) (n int, err error) {
t.File.Truncate(0)
t.File.Seek(0, 0)
return t.File.Write(p)
}