Add reader
This commit is contained in:
parent
df812f2af2
commit
41e6d5faa4
|
@ -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{})
|
||||
}
|
Loading…
Reference in New Issue