Skip to content

Instantly share code, notes, and snippets.

@feynon
Last active March 12, 2023 19:35
Show Gist options
  • Save feynon/0cc7bab078849a0363a3f46546072292 to your computer and use it in GitHub Desktop.
Save feynon/0cc7bab078849a0363a3f46546072292 to your computer and use it in GitHub Desktop.
type File struct {
*file // os specific
}
func (f *File) Name() string {
return f.name
}
func (f *File) Read(b []byte) (n int, err error) {
if err := f.checkValid("read"); err != nil {
return 0, err
}
n, e := f.read(b)
return n, f.wrapErr("read", e)
}
func (f *File) checkValid(op string) error {
if f == nil {
return ErrInvalid
}
return nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment