Skip to content

Commit a36c0df

Browse files
committed
fix golangci lint action
Signed-off-by: dongjiang <dongjiang1989@126.com>
1 parent 4a3d92e commit a36c0df

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

tools/setup-envtest/env/env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ func (e *Env) PrintInfo(printFmt PrintFormat) {
366366
fmt.Fprintf(e.Out, "Version: %s\n", e.Version)
367367
fmt.Fprintf(e.Out, "OS/Arch: %s\n", e.Platform)
368368
if e.Platform.Hash != nil {
369-
fmt.Fprintf(e.Out, "%s: %s\n", e.Platform.Hash.Type, e.Platform.Hash.Value)
369+
fmt.Fprintf(e.Out, "%s: %s\n", e.Platform.Type, e.Platform.Value)
370370
}
371371
fmt.Fprintf(e.Out, "Path: %s\n", path)
372372
case PrintPath:

tools/setup-envtest/remote/read_body.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)