mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-19 12:04:03 +00:00
all: show error if platform has no rng
This commit is contained in:
@@ -15,5 +15,9 @@ var Reader io.Reader
|
|||||||
// Read is a helper function that calls Reader.Read using io.ReadFull.
|
// Read is a helper function that calls Reader.Read using io.ReadFull.
|
||||||
// On return, n == len(b) if and only if err == nil.
|
// On return, n == len(b) if and only if err == nil.
|
||||||
func Read(b []byte) (n int, err error) {
|
func Read(b []byte) (n int, err error) {
|
||||||
|
if Reader == nil {
|
||||||
|
panic("no rng")
|
||||||
|
}
|
||||||
|
|
||||||
return io.ReadFull(Reader, b)
|
return io.ReadFull(Reader, b)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user