21 lines
302 B
Go
21 lines
302 B
Go
|
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{})
|
||
|
}
|