chore: fix minor issues reported via staticcheck (#17639)

This commit is contained in:
guangwu 2023-07-13 11:33:11 +08:00 committed by GitHub
parent 6dc55fe5ed
commit f80b6926d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -513,7 +513,7 @@ func (cr *s3ChunkedReader) readTrailers() error {
wantSig := cr.getTrailerChunkSignature()
if !compareSignatureV4(string(sig), wantSig) {
if cr.debug {
fmt.Printf("signature, want: %q, got %q\nSignature buffer: %q\n", wantSig, string(sig), string(valueBuffer.Bytes()))
fmt.Printf("signature, want: %q, got %q\nSignature buffer: %q\n", wantSig, string(sig), valueBuffer.String())
}
return errSignatureMismatch
}

View File

@ -23,7 +23,6 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
"net/url"
"os"
@ -97,7 +96,7 @@ type localDisk struct {
func getMajorMinor(path string) (string, error) {
var stat syscall.Stat_t
if err := syscall.Stat(path, &stat); err != nil {
return "", fmt.Errorf("unable to stat `%s`: %w", err)
return "", fmt.Errorf("unable to stat `%s`: %w", path, err)
}
major := (stat.Dev & 0x00000000000fff00) >> 8
@ -137,7 +136,7 @@ func filterLocalDisks(node, args string) ([]localDisk, error) {
}
func getFormatJSON(path string) (format, error) {
formatJSON, err := ioutil.ReadFile(filepath.Join(path, ".minio.sys/format.json"))
formatJSON, err := os.ReadFile(filepath.Join(path, ".minio.sys/format.json"))
if err != nil {
return format{}, err
}