solutions: Add solution for Readers exercise
The solution to this exercise was missing.
Fixes golang/tour#34
Change-Id: Ic416ab207a0acc9f196803f4df4497a36ea3d702
Reviewed-on: https://go-review.googlesource.com/34957
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/solutions/readers.go b/solutions/readers.go
new file mode 100644
index 0000000..278cd65
--- /dev/null
+++ b/solutions/readers.go
@@ -0,0 +1,22 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build ignore
+
+package main
+
+import "golang.org/x/tour/reader"
+
+type MyReader struct{}
+
+func (r MyReader) Read(b []byte) (int, error) {
+ for i := range b {
+ b[i] = 'A'
+ }
+ return len(b), nil
+}
+
+func main() {
+ reader.Validate(MyReader{})
+}