Skip to content

Commit

Permalink
Fix newUUID (google#70)
Browse files Browse the repository at this point in the history
The checking `n` returned by `io.ReadFull()` is removed because `io.ReadFull()` returns n == len(buf) if and only if err == nil according to its document ( https://golang.org/pkg/io/#ReadFull ) and it's enough to check only `err`.
  • Loading branch information
keijiyoshida authored and aren55555 committed Jan 30, 2017
1 parent d550198 commit e126f9a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ func (r *Runtime) instrumentCall(start Event, stop Event, c func() error) error
// citation: http://play.golang.org/p/4FkNSiUDMg
func newUUID() (string, error) {
uuid := make([]byte, 16)
n, err := io.ReadFull(rand.Reader, uuid)
if n != len(uuid) || err != nil {
if _, err := io.ReadFull(rand.Reader, uuid); err != nil {
return "", err
}
// variant bits; see section 4.1.1
Expand Down

0 comments on commit e126f9a

Please sign in to comment.