Skip to content

Instantly share code, notes, and snippets.

@rndD
Last active September 24, 2023 17:09
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rndD/5ba3c7c9883de396a4ea to your computer and use it in GitHub Desktop.
Save rndD/5ba3c7c9883de396a4ea to your computer and use it in GitHub Desktop.
A tour of Go: Exercise: Readers
package main
import "code.google.com/p/go-tour/reader"
type MyReader struct{}
func (r MyReader) Read(bytes []byte) (int, error) {
for i := range bytes {
bytes[i] = 65
}
return len(bytes), nil
}
// TODO: Add a Read([]byte) (int, error) method to MyReader.
func main() {
reader.Validate(MyReader{})
}
@rndD
Copy link
Author

rndD commented Sep 24, 2023

The description of the problem didn't make sense to me. Thank you for the solution.

You are welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment