@@ -23,13 +23,13 @@ func readBody(resp *http.Response, out io.Writer, archiveName string, platform v
23
23
// memory to avoid causing issues with big files.
24
24
buf := make ([]byte , 32 * 1024 ) // 32KiB, same as io.Copy
25
25
var hasher hash.Hash
26
- switch platform .Hash . Type {
26
+ switch platform .Type {
27
27
case versions .SHA512HashType :
28
28
hasher = sha512 .New ()
29
29
case versions .MD5HashType :
30
30
hasher = md5 .New ()
31
31
default :
32
- return fmt .Errorf ("hash type %s not implemented" , platform .Hash . Type )
32
+ return fmt .Errorf ("hash type %s not implemented" , platform .Type )
33
33
}
34
34
for cont := true ; cont ; {
35
35
amt , err := resp .Body .Read (buf )
@@ -47,16 +47,16 @@ func readBody(resp *http.Response, out io.Writer, archiveName string, platform v
47
47
}
48
48
49
49
var sum string
50
- switch platform .Hash . Encoding {
50
+ switch platform .Encoding {
51
51
case versions .Base64HashEncoding :
52
52
sum = base64 .StdEncoding .EncodeToString (hasher .Sum (nil ))
53
53
case versions .HexHashEncoding :
54
54
sum = hex .EncodeToString (hasher .Sum (nil ))
55
55
default :
56
- return fmt .Errorf ("hash encoding %s not implemented" , platform .Hash . Encoding )
56
+ return fmt .Errorf ("hash encoding %s not implemented" , platform .Encoding )
57
57
}
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 )
60
60
}
61
61
} else if _ , err := io .Copy (out , resp .Body ); err != nil {
62
62
return fmt .Errorf ("unable to download %s: %w" , archiveName , err )
0 commit comments