Created
March 27, 2016 22:48
-
-
Save a-h/e5fcc558903f98dc1eb0 to your computer and use it in GitHub Desktop.
Implement Reader in Go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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