mirror of
https://github.com/jimeh/rands.git
synced 2026-02-19 11:26:38 +00:00
docs(examples): add error handling to examples
This commit is contained in:
@@ -2,11 +2,16 @@ package rands_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/jimeh/rands"
|
||||
)
|
||||
|
||||
func ExampleBytes() {
|
||||
b, _ := rands.Bytes(8)
|
||||
fmt.Printf("%+v\n", b) // => [0 220 137 243 135 204 34 63]
|
||||
b, err := rands.Bytes(8)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Printf("%+v\n", b) // => [181 153 143 235 241 20 208 173]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user