From 41e6d5faa47a62c09912ec248e130be8011b218e Mon Sep 17 00:00:00 2001 From: Alex Denes Date: Fri, 30 Apr 2021 17:32:06 +0000 Subject: [PATCH] Add reader --- reader.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 reader.go diff --git a/reader.go b/reader.go new file mode 100644 index 0000000..3a4f000 --- /dev/null +++ b/reader.go @@ -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{}) +}