RSS 2025-12-06 03:49
libraries

Does a Readable make sense here?

来源:Reddit r/golang

I just want to make sure that I am understanding the reader interface properly. I'm writing a text editor, one can read from a buffer (using vim or emacs terms). And they can also read from other things, such as the underlying storage used by a buffer. Now I want a way of saying that I can read from something, so that I can pass that interface to functions that do things like saving. So I thought of the following

type Readable interface { NewReader() io.Reader } 

Does this make sense or have I got a bit confused?

submitted by /u/Moist-Plenty-9499
[link] [comments]