Add reader

This commit is contained in:
Alex D. 2021-04-30 17:32:06 +00:00
parent df812f2af2
commit 41e6d5faa4
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 20 additions and 0 deletions

20
reader.go Normal file
View File

@ -0,0 +1,20 @@
package main
import "golang.org/x/tour/reader"
type MyReader struct{}
// TODO: Add a Read([]byte) (int, error) method to MyReader.
func (m MyReader) Read(b []byte) (int, error) {
cnt := 0
for i := range b {
b[i] = 'A'
cnt++
}
return cnt, nil
}
func main() {
reader.Validate(MyReader{})
}