Skip to content

Instantly share code, notes, and snippets.

@takatoshiono
Created September 3, 2016 09:21
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 takatoshiono/a1aeddb270c9bd584badd8d7f0ede955 to your computer and use it in GitHub Desktop.
Save takatoshiono/a1aeddb270c9bd584badd8d7f0ede955 to your computer and use it in GitHub Desktop.
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{})
}
@takatoshiono
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment