Source file tour/solutions/readers.go

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build ignore
     6  
     7  package main
     8  
     9  import "golang.org/x/tour/reader"
    10  
    11  type MyReader struct{}
    12  
    13  func (r MyReader) Read(b []byte) (int, error) {
    14  	for i := range b {
    15  		b[i] = 'A'
    16  	}
    17  	return len(b), nil
    18  }
    19  
    20  func main() {
    21  	reader.Validate(MyReader{})
    22  }
    23  

View as plain text