Join GitHub today
proposal: Go 2: remove io.Seeker, SeekStart, etc., change Seek method #25854
For Go 2 we should consider changing the
Rationale: the current
See also #17920, which this would replace.
I looked through all my own code and the Go code at my company.
I support the proposal to reduce the
That said, I wouldn't discount use-cases for
f.Seek(n, SeekStart) => f.Seek(n) f.Seek(n, SeekCurrent) => f.Seek(f.CurrentOffset()+n) f.Seek(n, SeekEnd) => f.Seek(f.EndOffset()+n)
I much rather see idiomatic methods to access the current offset and end offset than separate
os.File is an API to the OS. Second-guessing the OS model for that API could have unintended consequences. If you must change os.File.Seek, please
a) rename os.File.Seek to .SeekFrom, and
For an append-only file with an index at file's end, I use seek-from-end to read the index size, then seek-from-current to read the index. Thanks!