1
0
mirror of https://github.com/golang/go synced 2024-11-22 09:14:40 -07:00

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
This commit is contained in:
Rob Pike 2013-08-12 12:52:23 +10:00
parent 24c8035fbe
commit ce00562607

View File

@ -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
}