go-tour/exercise-reader.go
2020-02-09 10:44:41 -06:00

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{})
}