Commit ce005626 authored by Rob Pike's avatar Rob Pike

crypto/rand: simplify example to exploit properties of ReadFull

No need for the complex condition.
Fixes #6089

R=golang-dev, mischief, adg
CC=golang-dev
https://golang.org/cl/12731043
parent 24c8035f
......@@ -16,8 +16,8 @@ import (
func ExampleRead() {
c := 10
b := make([]byte, c)
n, err := io.ReadFull(rand.Reader, b)
if n != len(b) || err != nil {
_, err := io.ReadFull(rand.Reader, b)
if err != nil {
fmt.Println("error:", err)
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment