@@ -23,13 +23,13 @@ func readBody(resp *http.Response, out io.Writer, archiveName string, platform v
2323 // memory to avoid causing issues with big files.
2424 buf := make ([]byte , 32 * 1024 ) // 32KiB, same as io.Copy
2525 var hasher hash.Hash
26- switch platform .Hash . Type {
26+ switch platform .Type {
2727 case versions .SHA512HashType :
2828 hasher = sha512 .New ()
2929 case versions .MD5HashType :
3030 hasher = md5 .New ()
3131 default :
32- return fmt .Errorf ("hash type %s not implemented" , platform .Hash . Type )
32+ return fmt .Errorf ("hash type %s not implemented" , platform .Type )
3333 }
3434 for cont := true ; cont ; {
3535 amt , err := resp .Body .Read (buf )
@@ -47,16 +47,16 @@ func readBody(resp *http.Response, out io.Writer, archiveName string, platform v
4747 }
4848
4949 var sum string
50- switch platform .Hash . Encoding {
50+ switch platform .Encoding {
5151 case versions .Base64HashEncoding :
5252 sum = base64 .StdEncoding .EncodeToString (hasher .Sum (nil ))
5353 case versions .HexHashEncoding :
5454 sum = hex .EncodeToString (hasher .Sum (nil ))
5555 default :
56- return fmt .Errorf ("hash encoding %s not implemented" , platform .Hash . Encoding )
56+ return fmt .Errorf ("hash encoding %s not implemented" , platform .Encoding )
5757 }
58- if sum != platform .Hash . Value {
59- return fmt .Errorf ("checksum mismatch for %s: %s (computed) != %s (reported)" , archiveName , sum , platform .Hash . Value )
58+ if sum != platform .Value {
59+ return fmt .Errorf ("checksum mismatch for %s: %s (computed) != %s (reported)" , archiveName , sum , platform .Value )
6060 }
6161 } else if _ , err := io .Copy (out , resp .Body ); err != nil {
6262 return fmt .Errorf ("unable to download %s: %w" , archiveName , err )
0 commit comments