20 lines
320 B
Go
20 lines
320 B
Go
package main
|
|
|
|
import "golang.org/x/tour/reader"
|
|
|
|
type MyReader struct{}
|
|
|
|
// TODO: Add a Read([]byte) (int, error) method to MyReader.
|
|
|
|
func (MyReader) Read(b []byte) (int, error) {
|
|
c := "A"
|
|
for i := range b {
|
|
b[i] = byte(c[0])
|
|
}
|
|
return len(b), nil
|
|
}
|
|
|
|
func main() {
|
|
reader.Validate(MyReader{})
|
|
}
|