1
0
mirror of https://github.com/moby/buildkit.git synced 2025-04-18 18:04:03 +03:00

identity: remove pkg/errors

It's only used in a panic, so the additional functionality of pkg/errors
is unlikely needed for this. While at it, also removing an unneeded
import alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2024-06-12 16:08:48 +02:00
parent 313a611bfd
commit dca58dc6b4
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -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
@ -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