vet: Fix all the go vet complaints (#4029)

```
go tool vet -atomic -bool -copylocks -nilfunc \
   -printf -shadow -rangeloops -unreachable \
   -unsafeptr -unusedresult cmd/
```
master
Harshavardhana 8 years ago committed by GitHub
parent 2bd694dbc8
commit 4de6b15fca
  1. 4
      Makefile
  2. 6
      cmd/admin-handlers_test.go
  3. 4
      cmd/azure-anonymous.go
  4. 9
      cmd/logger.go
  5. 6
      cmd/xl-v1-healing_test.go

@ -79,8 +79,8 @@ verifiers: vet fmt lint cyclo spelling
vet:
@echo -n "Running $@: "
@go vet github.com/minio/minio/cmd/...
@go vet github.com/minio/minio/pkg/...
@go tool vet -atomic -bool -copylocks -nilfunc -printf -shadow -rangeloops -unreachable -unsafeptr -unusedresult cmd
@go tool vet -atomic -bool -copylocks -nilfunc -printf -shadow -rangeloops -unreachable -unsafeptr -unusedresult pkg
@echo "Done."
fmt:

@ -1162,9 +1162,9 @@ func TestHealUploadHandler(t *testing.T) {
for i, test := range testCases {
// Prepare query params.
queryVal := mkHealUploadQuery(test.bucket, test.object, uploadID, test.dryrun)
req, err := buildAdminRequest(queryVal, "upload", http.MethodPost, 0, nil)
if err != nil {
t.Fatalf("Test %d - Failed to construct heal object request - %v", i+1, err)
req, err1 := buildAdminRequest(queryVal, "upload", http.MethodPost, 0, nil)
if err1 != nil {
t.Fatalf("Test %d - Failed to construct heal object request - %v", i+1, err1)
}
rec := httptest.NewRecorder()
adminTestBed.mux.ServeHTTP(rec, req)

@ -60,8 +60,8 @@ func (a AzureObjects) AnonGetBucketInfo(bucket string) (bucketInfo BucketInfo, e
// AnonGetObject - SendGET request without authentication.
// 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) {
url := a.client.GetBlobURL(bucket, object)
req, err := http.NewRequest("GET", url, nil)
u := a.client.GetBlobURL(bucket, object)
req, err := http.NewRequest("GET", u, nil)
if err != nil {
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 {
logger := logrus.New()
logger.Out = ioutil.Discard
logger.Level = logrus.DebugLevel
log := &Logger{
l := &Logger{
logger: logger,
consoleTarget: NewConsoleLogger(),
}
logger.Hooks.Add(log)
// Adds a console logger.
logger.Hooks.Add(l)
return log
return l
}
func getSource() string {

@ -534,10 +534,10 @@ func TestHealObjectXL(t *testing.T) {
var uploadedParts []completePart
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), "", "")
if err != nil {
t.Fatalf("Failed to upload a part - %v", err)
if err1 != nil {
t.Fatalf("Failed to upload a part - %v", err1)
}
uploadedParts = append(uploadedParts, completePart{
PartNumber: pInfo.PartNumber,

Loading…
Cancel
Save