Why, exactly, would rand.Read() (from crypto) return an error? Anyone?
io.Reader and thus needs to have the same signature:
Read(p byte) (n int, err error)
I cannot say if this is the only reason or if rand.Read() can indeed error out. After all, it does a system call that possibly might fail.
The signature must match. Thanks for the clue, christophberger. I was paying more attention to what it’s doing and less to what it’s implementing…
My question would have been better framed as “why would that system call fail” after thinking about it, but that’s a question for elsewhere
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.