Skip to content

Instantly share code, notes, and snippets.

@azhuox

azhuox/block9.go Secret

Created December 2, 2020 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azhuox/a5e5c71beaa839ab37ae5eb510d05631 to your computer and use it in GitHub Desktop.
Save azhuox/a5e5c71beaa839ab37ae5eb510d05631 to your computer and use it in GitHub Desktop.
package io
// Reader is the interface that wraps the basic Read method.
type Reader interface {
Read(p []byte) (n int, err error)
}
type multiReader struct {
readers []Reader
}
func (mr *multiReader) Read(p []byte) (n int, err error) {
// Blah blah blah.
return 0, EOF
}
// MultiReader returns a Reader that's the logical concatenation of the provided input readers.
func MultiReader(readers ...Reader) Reader {
r := make([]Reader, len(readers))
copy(r, readers)
return &multiReader{r}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment