Last active
March 12, 2023 19:35
-
-
Save feynon/0cc7bab078849a0363a3f46546072292 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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