mirror of
https://github.com/minio/minio.git
synced 2025-04-04 11:50:36 -04:00
vet: Fix all the go vet complaints (#4029)
``` go tool vet -atomic -bool -copylocks -nilfunc \ -printf -shadow -rangeloops -unreachable \ -unsafeptr -unusedresult cmd/ ```
This commit is contained in:
parent
2bd694dbc8
commit
4de6b15fca
4
Makefile
4
Makefile
@ -79,8 +79,8 @@ verifiers: vet fmt lint cyclo spelling
|
|||||||
|
|
||||||
vet:
|
vet:
|
||||||
@echo -n "Running $@: "
|
@echo -n "Running $@: "
|
||||||
@go vet github.com/minio/minio/cmd/...
|
@go tool vet -atomic -bool -copylocks -nilfunc -printf -shadow -rangeloops -unreachable -unsafeptr -unusedresult cmd
|
||||||
@go vet github.com/minio/minio/pkg/...
|
@go tool vet -atomic -bool -copylocks -nilfunc -printf -shadow -rangeloops -unreachable -unsafeptr -unusedresult pkg
|
||||||
@echo "Done."
|
@echo "Done."
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
|
@ -1162,9 +1162,9 @@ func TestHealUploadHandler(t *testing.T) {
|
|||||||
for i, test := range testCases {
|
for i, test := range testCases {
|
||||||
// Prepare query params.
|
// Prepare query params.
|
||||||
queryVal := mkHealUploadQuery(test.bucket, test.object, uploadID, test.dryrun)
|
queryVal := mkHealUploadQuery(test.bucket, test.object, uploadID, test.dryrun)
|
||||||
req, err := buildAdminRequest(queryVal, "upload", http.MethodPost, 0, nil)
|
req, err1 := buildAdminRequest(queryVal, "upload", http.MethodPost, 0, nil)
|
||||||
if err != nil {
|
if err1 != nil {
|
||||||
t.Fatalf("Test %d - Failed to construct heal object request - %v", i+1, err)
|
t.Fatalf("Test %d - Failed to construct heal object request - %v", i+1, err1)
|
||||||
}
|
}
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
adminTestBed.mux.ServeHTTP(rec, req)
|
adminTestBed.mux.ServeHTTP(rec, req)
|
||||||
|
@ -60,8 +60,8 @@ func (a AzureObjects) AnonGetBucketInfo(bucket string) (bucketInfo BucketInfo, e
|
|||||||
// AnonGetObject - SendGET request without authentication.
|
// AnonGetObject - SendGET request without authentication.
|
||||||
// This is needed when clients send GET requests on objects that can be downloaded without auth.
|
// This is needed when clients send GET requests on objects that can be downloaded without auth.
|
||||||
func (a AzureObjects) AnonGetObject(bucket, object string, startOffset int64, length int64, writer io.Writer) (err error) {
|
func (a AzureObjects) AnonGetObject(bucket, object string, startOffset int64, length int64, writer io.Writer) (err error) {
|
||||||
url := a.client.GetBlobURL(bucket, object)
|
u := a.client.GetBlobURL(bucket, object)
|
||||||
req, err := http.NewRequest("GET", url, nil)
|
req, err := http.NewRequest("GET", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return azureToObjectError(traceError(err), bucket, object)
|
return azureToObjectError(traceError(err), bucket, object)
|
||||||
}
|
}
|
||||||
|
@ -153,20 +153,21 @@ func (log *Logger) Printf(format string, args ...interface{}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLogger - returns new logger.
|
// NewLogger - returns a new initialized logger.
|
||||||
func NewLogger() *Logger {
|
func NewLogger() *Logger {
|
||||||
logger := logrus.New()
|
logger := logrus.New()
|
||||||
logger.Out = ioutil.Discard
|
logger.Out = ioutil.Discard
|
||||||
logger.Level = logrus.DebugLevel
|
logger.Level = logrus.DebugLevel
|
||||||
|
|
||||||
log := &Logger{
|
l := &Logger{
|
||||||
logger: logger,
|
logger: logger,
|
||||||
consoleTarget: NewConsoleLogger(),
|
consoleTarget: NewConsoleLogger(),
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Hooks.Add(log)
|
// Adds a console logger.
|
||||||
|
logger.Hooks.Add(l)
|
||||||
|
|
||||||
return log
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSource() string {
|
func getSource() string {
|
||||||
|
@ -534,10 +534,10 @@ func TestHealObjectXL(t *testing.T) {
|
|||||||
|
|
||||||
var uploadedParts []completePart
|
var uploadedParts []completePart
|
||||||
for _, partID := range []int{2, 1} {
|
for _, partID := range []int{2, 1} {
|
||||||
pInfo, err := obj.PutObjectPart(bucket, object, uploadID, partID,
|
pInfo, err1 := obj.PutObjectPart(bucket, object, uploadID, partID,
|
||||||
int64(len(data)), bytes.NewReader(data), "", "")
|
int64(len(data)), bytes.NewReader(data), "", "")
|
||||||
if err != nil {
|
if err1 != nil {
|
||||||
t.Fatalf("Failed to upload a part - %v", err)
|
t.Fatalf("Failed to upload a part - %v", err1)
|
||||||
}
|
}
|
||||||
uploadedParts = append(uploadedParts, completePart{
|
uploadedParts = append(uploadedParts, completePart{
|
||||||
PartNumber: pInfo.PartNumber,
|
PartNumber: pInfo.PartNumber,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user