From 5e36877d2a5f41d4e0109d63025d68ce1929054a Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Mon, 5 Aug 2013 14:23:32 -0400 Subject: [PATCH] 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 --- src/pkg/crypto/crypto.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pkg/crypto/crypto.go b/src/pkg/crypto/crypto.go index 52ec40bc2f..4b03628e69 100644 --- a/src/pkg/crypto/crypto.go +++ b/src/pkg/crypto/crypto.go @@ -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. -- 2.48.1