mark/vfs/vfs.go
Manuel Rüger 7d4d0458ca fix: narrow vfs.Opener interface from ReadWriteCloser to ReadCloser
All callers only read from the opened file (io.ReadAll + Close). Using
io.ReadWriteCloser in the interface was misleading and violated the
principle of interface segregation. os.Open returns a read-only file
that satisfies io.ReadCloser but not the write contract implied by
io.ReadWriteCloser. Narrow both the interface and the implementation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-16 19:18:29 +01:00

20 lines
258 B
Go

package vfs
import (
"io"
"os"
)
type Opener interface {
Open(name string) (io.ReadCloser, error)
}
type LocalOSOpener struct {
}
func (o LocalOSOpener) Open(name string) (io.ReadCloser, error) {
return os.Open(name)
}
var LocalOS = LocalOSOpener{}