diff options
| author | Antoine Martin <antoine97.martin@gmail.com> | 2017-01-09 00:55:10 +0100 |
|---|---|---|
| committer | Joe Tsai <thebrokentoaster@gmail.com> | 2017-01-09 06:23:46 +0000 |
| commit | d153aa6df875151e72670741898a3ab7f053097b (patch) | |
| tree | 4196dee8b8484107fdab8f18c1128dd65b779c70 | |
| parent | f6d699bfddca2e6539e3e972913aeb2a55b1ff1b (diff) | |
| download | golang-id-tour-d153aa6df875151e72670741898a3ab7f053097b.tar.xz | |
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>
| -rw-r--r-- | solutions/readers.go | 22 |
1 files changed, 22 insertions, 0 deletions
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{}) +} |
