1
0
mirror of https://github.com/golang/go synced 2024-11-12 08:40:21 -07:00

crypto: include hash number in panic message.

In the event that code tries to use a hash function that isn't compiled
in and panics, give the developer a fighting chance of figuring out
which hash function it needed.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12420045
This commit is contained in:
Adam Langley 2013-08-05 14:23:32 -04:00
parent 6abbbcdc75
commit 5e36877d2a

View File

@ -7,6 +7,7 @@ package crypto
import (
"hash"
"strconv"
)
// Hash identifies a cryptographic hash function that is implemented in another
@ -59,7 +60,7 @@ func (h Hash) New() hash.Hash {
return f()
}
}
panic("crypto: requested hash function is unavailable")
panic("crypto: requested hash function #" + strconv.Itoa(int(h)) + " is unavailable")
}
// Available reports whether the given hash function is linked into the binary.