Create a gist now

Instantly share code, notes, and snippets.

A Tour of Go: Exercise: Readers, https://go-tour-jp.appspot.com/methods/22
package main
import "golang.org/x/tour/reader"
type MyReader struct{}
// Add a Read([]byte) (int, error) method to MyReader.
func (r MyReader) Read(b []byte) (int, error) {
b[0] = '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