Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: bytes: implement io.Seeker, io.ReaderAt, io.WriterAt for Buffer #65076

Closed
godcong opened this issue Jan 12, 2024 · 1 comment
Closed
Labels
Milestone

Comments

@godcong
Copy link

godcong commented Jan 12, 2024

Proposal Details

I found that Buffer doesn't support read/write to a specific location when using bytes.Buffer.
This makes it inconvenient when I need to write a []byte in a specified location.
To make it easier to use, I'd like to help implement these basic functions.

type Seeker interface {
	Seek(offset int64, whence int) (int64, error)
}
type WriterAt interface {
	WriteAt(p []byte, off int64) (n int, err error)
}
type ReaderAt interface {
	ReadAt(p []byte, off int64) (n int, err error)
}
@gopherbot gopherbot added this to the Proposal milestone Jan 12, 2024
@seankhliao seankhliao changed the title proposal: bytes/buffer: implements io.Seeker, io.ReaderAt, io.WriterAt interfaces for offset read/write. proposal: bytes: implement io.Seeker, io.ReaderAt, io.WriterAt for Buffer Jan 13, 2024
@mvdan
Copy link
Member

mvdan commented Jan 14, 2024

Did you research previous threads like #21899?

@godcong godcong closed this as completed Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants