Source file tour/solutions/readers.go

     1  //go:build OMIT
     2  
     3  // Copyright 2017 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     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