Skip to content

Commit

Permalink
Merge pull request #5025 from thaJeztah/identity_stdlib
Browse files Browse the repository at this point in the history
identity: remove pkg/errors
  • Loading branch information
tonistiigi authored Jun 13, 2024
2 parents 2aff238 + dca58dc commit b7e78d0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions identity/randomid.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package identity

import (
cryptorand "crypto/rand"
"crypto/rand"
"io"
"math/big"

"github.com/pkg/errors"
)

var (
// idReader is used for random id generation. This declaration allows us to
// replace it for testing.
idReader = cryptorand.Reader
idReader = rand.Reader
)

// parameters for random identifier generation. We can tweak this when there is
Expand Down Expand Up @@ -46,7 +44,7 @@ func NewID() string {
var p [randomIDEntropyBytes]byte

if _, err := io.ReadFull(idReader, p[:]); err != nil {
panic(errors.Wrap(err, "failed to read random bytes: %v"))
panic("failed to read random bytes: " + err.Error())
}

p[0] |= 0x80 // set high bit to avoid the need for padding
Expand Down

0 comments on commit b7e78d0

Please sign in to comment.