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:
parent
24c8035fbe
commit
ce00562607
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user