This is an effort to remove panic from the source.
Add a new call called CriticialIf, that calls LogIf and exits.
Replace panics with one of CriticalIf, FatalIf and a return of error.
panic("Failed to decode fixed magic HighwayHash256 key: Please report this bug at https://github.com/minio/minio/issues")
logger.CriticalIf(context.Background(),errors.New("Failed to decode fixed magic HighwayHash256 key. Please report this bug at https://github.com/minio/minio/issues"))
}
newBLAKE2b:=func()hash.Hash{
@ -80,11 +81,12 @@ var bitrotAlgorithms = map[BitrotAlgorithm]string{
HighwayHash256:"highwayhash256",
}
// New returns a new hash.Hash calculating the given bitrot algorithm. New panics
// if the algorithm is not supported or not linked into the binary.
// New returns a new hash.Hash calculating the given bitrot algorithm.
// New logs error and exits if the algorithm is not supported or not
// linked into the binary.
func(aBitrotAlgorithm)New()hash.Hash{
if_,ok:=bitrotAlgorithms[a];!ok{
panic(fmt.Sprintf("bitrot algorithm #%d is not supported",a))