Skip to content

Instantly share code, notes, and snippets.

@danimal141
Created October 10, 2016 12:32
Show Gist options
  • Save danimal141/adbbfa88a9dd4b7b91d692482c81a706 to your computer and use it in GitHub Desktop.
Save danimal141/adbbfa88a9dd4b7b91d692482c81a706 to your computer and use it in GitHub Desktop.
A Tour of Go Exercise: Readers
package main
import "golang.org/x/tour/reader"
type MyReader struct{}
func (r MyReader) Read(b []byte) (int, error) {
for i := range b {
b[i] = 'A'
}
return len(b), nil
}
func main() {
reader.Validate(MyReader{})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment