Skip to content

Instantly share code, notes, and snippets.

@a-h
Created March 27, 2016 22:48
Show Gist options
  • Select an option

  • Save a-h/e5fcc558903f98dc1eb0 to your computer and use it in GitHub Desktop.

Select an option

Save a-h/e5fcc558903f98dc1eb0 to your computer and use it in GitHub Desktop.
Implement Reader in Go
package main
import "golang.org/x/tour/reader"
type MyReader struct{}
func (MyReader) Read(b []byte) (n int, err error) {
for i := 0; i < len(b); i ++ {
b[i] = 'A'
}
return 1, nil
}
func main() {
reader.Validate(MyReader{})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment