From 6173eff288c73237588fc3bba5ee862e996d5fc2 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 18 Aug 2015 23:58:04 -0700 Subject: [PATCH] update mc to new changes in probe and minio-go (0.2.2) --- error.go | 19 ++- internal/github.com/mattn/go-isatty/LICENSE | 9 ++ internal/github.com/minio/minio-go/README.md | 2 +- .../minio/minio-go/api-multipart-v1.go | 2 +- internal/github.com/minio/minio-go/api-v1.go | 2 +- internal/github.com/minio/minio-go/api-v2.go | 63 ++++++---- .../github.com/minio/minio-go/bucket-acl.go | 2 +- internal/github.com/minio/minio-go/chopper.go | 2 +- internal/github.com/minio/minio-go/common.go | 2 +- .../github.com/minio/minio-go/definitions.go | 2 +- internal/github.com/minio/minio-go/errors.go | 2 +- internal/github.com/minio/minio-go/request.go | 2 +- .../github.com/minio/minio/pkg/probe/probe.go | 110 +++++------------- .../minio/minio/pkg/probe/wrapper.go | 43 +++++++ internal/vendor.json | 24 ++-- ls.go | 4 +- print-structs.go | 9 +- 17 files changed, 152 insertions(+), 147 deletions(-) create mode 100644 internal/github.com/mattn/go-isatty/LICENSE create mode 100644 internal/github.com/minio/minio/pkg/probe/wrapper.go diff --git a/error.go b/error.go index 97a6dfe1..f80164a7 100644 --- a/error.go +++ b/error.go @@ -17,7 +17,6 @@ package main import ( - "encoding/json" "os" "reflect" @@ -33,18 +32,17 @@ func fatalIf(err *probe.Error) { if globalJSONFlag { errorMessage := ErrorMessage{ Type: "Fatal", - TypedError: reflect.TypeOf(err.ToError()).String(), - EmbeddedError: err.ToError(), + TypedError: reflect.TypeOf(err.ToGoError()).String(), + EmbeddedError: err.ToGoError(), } if globalDebugFlag { - rawProbe := json.RawMessage(err.JSON()) - errorMessage.ProbeError = &rawProbe + errorMessage.ProbeError = err } console.Println(errorMessage) os.Exit(1) } if !globalDebugFlag { - console.Fatalln(err.ToError()) + console.Fatalln(err.ToGoError()) } console.Fatalln(err) } @@ -57,18 +55,17 @@ func errorIf(err *probe.Error) { if globalJSONFlag { errorMessage := ErrorMessage{ Type: "Error", - TypedError: reflect.TypeOf(err.ToError()).String(), - EmbeddedError: err.ToError(), + TypedError: reflect.TypeOf(err.ToGoError()).String(), + EmbeddedError: err.ToGoError(), } if globalDebugFlag { - rawProbe := json.RawMessage(err.JSON()) - errorMessage.ProbeError = &rawProbe + errorMessage.ProbeError = err } console.Println(errorMessage) return } if !globalDebugFlag { - console.Errorln(err.ToError()) + console.Errorln(err.ToGoError()) return } console.Errorln(err) diff --git a/internal/github.com/mattn/go-isatty/LICENSE b/internal/github.com/mattn/go-isatty/LICENSE new file mode 100644 index 00000000..65dc692b --- /dev/null +++ b/internal/github.com/mattn/go-isatty/LICENSE @@ -0,0 +1,9 @@ +Copyright (c) Yasuhiro MATSUMOTO + +MIT License (Expat) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/internal/github.com/minio/minio-go/README.md b/internal/github.com/minio/minio-go/README.md index c26d882a..4d5cb3fb 100644 --- a/internal/github.com/minio/minio-go/README.md +++ b/internal/github.com/minio/minio-go/README.md @@ -1,4 +1,4 @@ -# Minio Go Library for Amazon S3 compatible cloud storage [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/minio/minio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +# Minio Go Library for Amazon S3 Compatible Cloud Storage [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/minio/minio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ## Install [![Build Status](https://travis-ci.org/minio/minio-go.svg)](https://travis-ci.org/minio/minio-go) diff --git a/internal/github.com/minio/minio-go/api-multipart-v1.go b/internal/github.com/minio/minio-go/api-multipart-v1.go index 72a7ea71..805d518a 100644 --- a/internal/github.com/minio/minio-go/api-multipart-v1.go +++ b/internal/github.com/minio/minio-go/api-multipart-v1.go @@ -1,5 +1,5 @@ /* - * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc. + * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/github.com/minio/minio-go/api-v1.go b/internal/github.com/minio/minio-go/api-v1.go index 5b5f6324..db9fa1e5 100644 --- a/internal/github.com/minio/minio-go/api-v1.go +++ b/internal/github.com/minio/minio-go/api-v1.go @@ -1,5 +1,5 @@ /* - * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc. + * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/github.com/minio/minio-go/api-v2.go b/internal/github.com/minio/minio-go/api-v2.go index c7b67291..59ffbb72 100644 --- a/internal/github.com/minio/minio-go/api-v2.go +++ b/internal/github.com/minio/minio-go/api-v2.go @@ -1,5 +1,5 @@ /* - * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc. + * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,11 +25,12 @@ import ( "path/filepath" "runtime" "sort" + "strconv" "strings" "time" ) -// API - cloud storage API interface +// API - Cloud Storage API interface type API interface { // Bucket Read/Write/Stat operations BucketAPI @@ -177,7 +178,7 @@ type Config struct { // Global constants const ( LibraryName = "minio-go" - LibraryVersion = "0.2.1" + LibraryVersion = "0.2.2" ) // SetUserAgent - append to a default user agent @@ -289,7 +290,7 @@ var maxParts = int64(10000) // maxPartSize - unexported right now var maxPartSize int64 = 1024 * 1024 * 1024 * 5 -// GetPartSize - calculate the optimal part size for the given objectSize +// calculatePartSize - calculate the optimal part size for the given objectSize // // NOTE: Assumption here is that for any given object upload to a S3 compatible object // storage it will have the following parameters as constants @@ -303,17 +304,16 @@ var maxPartSize int64 = 1024 * 1024 * 1024 * 5 // // special case where it happens to be that partSize is indeed bigger than the // maximum part size just return maxPartSize back -func getPartSize(objectSize int64) int64 { - partSize := (objectSize / (maxParts - 1)) // make sure last part has enough buffer and handle this poperly - { - if partSize > minimumPartSize { - if partSize > maxPartSize { - return maxPartSize - } - return partSize +func calculatePartSize(objectSize int64) int64 { + // make sure last part has enough buffer and handle this poperly + partSize := (objectSize / (maxParts - 1)) + if partSize > minimumPartSize { + if partSize > maxPartSize { + return maxPartSize } - return minimumPartSize + return partSize } + return minimumPartSize } func (a apiV2) newObjectUpload(bucket, object, contentType string, size int64, data io.Reader) error { @@ -324,15 +324,21 @@ func (a apiV2) newObjectUpload(bucket, object, contentType string, size int64, d uploadID := initiateMultipartUploadResult.UploadID completeMultipartUpload := completeMultipartUpload{} var totalLength int64 - for part := range chopper(data, getPartSize(size), nil) { + + partSize := calculatePartSize(size) + for part := range chopper(data, partSize, nil) { if part.Err != nil { return part.Err } - if part.Len < minimumPartSize { - if (size - totalLength) != part.Len { + // This check is primarily for last part + // This verifies if the part.Len was an unexpected read i.e if we lost few bytes + if part.Len < partSize { + expectedPartLen := size - totalLength + if expectedPartLen != part.Len { return ErrorResponse{ - Code: "IncompleteBody", - Message: "IncompleteBody", + Code: "UnexpectedShortRead", + Message: "Data read ‘" + strconv.FormatInt(expectedPartLen, 10) + "’ is less than the expected size ‘" + strconv.FormatInt(part.Len, 10) + "’", + Resource: separator + bucket + separator + object, } } } @@ -421,15 +427,20 @@ func (a apiV2) continueObjectUpload(bucket, object, uploadID string, size int64, partNumber: part.Metadata.PartNumber, }) } - for part := range chopper(data, getPartSize(size), skipParts) { + partSize := calculatePartSize(size) + for part := range chopper(data, partSize, skipParts) { if part.Err != nil { return part.Err } - if part.Len < minimumPartSize { - if (size - totalLength) != part.Len { + // This check is primarily for last part + // This verifies if the part.Len was an unexpected read i.e if we lost few bytes + if part.Len < partSize { + expectedPartLen := size - totalLength + if expectedPartLen != part.Len { return ErrorResponse{ - Code: "IncompleteBody", - Message: "IncompleteBody", + Code: "UnexpectedShortRead", + Message: "Data read ‘" + strconv.FormatInt(expectedPartLen, 10) + "’ is less than the expected size ‘" + strconv.FormatInt(part.Len, 10) + "’", + Resource: separator + bucket + separator + object, } } } @@ -515,10 +526,12 @@ func (a apiV2) PutObject(bucket, object, contentType string, size int64, data io if part.Err != nil { return part.Err } + // This verifies if the part.Len was an unexpected read i.e if we lost few bytes if part.Len != size { return ErrorResponse{ - Code: "IncompleteBody", - Message: "IncompleteBody", + Code: "MethodUnexpectedEOF", + Message: "Data read is less than the requested size", + Resource: separator + bucket + separator + object, } } _, err := a.putObject(bucket, object, contentType, part.MD5Sum, part.Len, part.ReadSeeker) diff --git a/internal/github.com/minio/minio-go/bucket-acl.go b/internal/github.com/minio/minio-go/bucket-acl.go index 30685b47..5718dbbd 100644 --- a/internal/github.com/minio/minio-go/bucket-acl.go +++ b/internal/github.com/minio/minio-go/bucket-acl.go @@ -1,5 +1,5 @@ /* - * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc. + * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/github.com/minio/minio-go/chopper.go b/internal/github.com/minio/minio-go/chopper.go index 02b0792d..6b2ff9a1 100644 --- a/internal/github.com/minio/minio-go/chopper.go +++ b/internal/github.com/minio/minio-go/chopper.go @@ -1,5 +1,5 @@ /* - * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc. + * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/github.com/minio/minio-go/common.go b/internal/github.com/minio/minio-go/common.go index 6263d559..1445645b 100644 --- a/internal/github.com/minio/minio-go/common.go +++ b/internal/github.com/minio/minio-go/common.go @@ -1,5 +1,5 @@ /* - * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc. + * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/github.com/minio/minio-go/definitions.go b/internal/github.com/minio/minio-go/definitions.go index 77e5db13..6d02589c 100644 --- a/internal/github.com/minio/minio-go/definitions.go +++ b/internal/github.com/minio/minio-go/definitions.go @@ -1,5 +1,5 @@ /* - * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc. + * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/github.com/minio/minio-go/errors.go b/internal/github.com/minio/minio-go/errors.go index ead4e252..5626cf0c 100644 --- a/internal/github.com/minio/minio-go/errors.go +++ b/internal/github.com/minio/minio-go/errors.go @@ -1,5 +1,5 @@ /* - * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc. + * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/github.com/minio/minio-go/request.go b/internal/github.com/minio/minio-go/request.go index 0e8ea21d..2905e1b2 100644 --- a/internal/github.com/minio/minio-go/request.go +++ b/internal/github.com/minio/minio-go/request.go @@ -1,5 +1,5 @@ /* - * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc. + * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/github.com/minio/minio/pkg/probe/probe.go b/internal/github.com/minio/minio/pkg/probe/probe.go index f1e57ee2..d1cfb8f5 100644 --- a/internal/github.com/minio/minio/pkg/probe/probe.go +++ b/internal/github.com/minio/minio/pkg/probe/probe.go @@ -18,7 +18,6 @@ package probe import ( - "encoding/json" "fmt" "os" "path/filepath" @@ -60,10 +59,10 @@ type tracePoint struct { // Error implements tracing error functionality. type Error struct { - lock sync.RWMutex - e error - sysInfo map[string]string - tracePoints []tracePoint + lock sync.RWMutex + Cause error `json:"cause,omitempty"` + CallTrace []tracePoint `json:"trace,omitempty"` + SysInfo map[string]string `json:"sysinfo,omitempty"` } // NewError function instantiates an error probe for tracing. Original errors.error (golang's error @@ -74,7 +73,7 @@ func NewError(e error) *Error { if e == nil { return nil } - Err := Error{sync.RWMutex{}, e, GetSysInfo(), []tracePoint{}} + Err := Error{lock: sync.RWMutex{}, Cause: e, CallTrace: []tracePoint{}, SysInfo: GetSysInfo()} return Err.trace() } @@ -104,7 +103,7 @@ func (e *Error) trace(fields ...string) *Error { } else { tp = tracePoint{Line: line, Filename: file, Function: function} } - e.tracePoints = append(e.tracePoints, tp) + e.CallTrace = append(e.CallTrace, tp) return e } @@ -116,101 +115,44 @@ func (e *Error) Untrace() { e.lock.Lock() defer e.lock.Unlock() - l := len(e.tracePoints) + l := len(e.CallTrace) if l == 0 { return } - // topTP := e.tracePoints[l-1] - e.tracePoints = e.tracePoints[:l-1] + e.CallTrace = e.CallTrace[:l-1] +} + +// ToGoError returns original error message. +func (e *Error) ToGoError() error { + return e.Cause } // String returns error message. func (e *Error) String() string { - if e == nil || e.e == nil { + if e == nil || e.Cause == nil { return "" } e.lock.RLock() defer e.lock.RUnlock() - if e.e != nil { - trace := e.e.Error() + "\n" - for i, tp := range e.tracePoints { + if e.Cause != nil { + str := e.Cause.Error() + "\n" + for i, tp := range e.CallTrace { if len(tp.Env) > 0 { - trace += fmt.Sprintf(" (%d) %s:%d %s(..) Tags: [%s]\n", i, tp.Filename, tp.Line, tp.Function, strings.Join(tp.Env["Tags"], ", ")) + str += fmt.Sprintf(" (%d) %s:%d %s(..) Tags: [%s]\n", i, tp.Filename, tp.Line, tp.Function, strings.Join(tp.Env["Tags"], ", ")) } else { - trace += fmt.Sprintf(" (%d) %s:%d %s(..)\n", i, tp.Filename, tp.Line, tp.Function) + str += fmt.Sprintf(" (%d) %s:%d %s(..)\n", i, tp.Filename, tp.Line, tp.Function) } } - trace += " Host:" + e.sysInfo["host.name"] + " | " - trace += "OS:" + e.sysInfo["host.os"] + " | " - trace += "Arch:" + e.sysInfo["host.arch"] + " | " - trace += "Lang:" + e.sysInfo["host.lang"] + " | " - trace += "Mem:" + e.sysInfo["mem.used"] + "/" + e.sysInfo["mem.total"] + " | " - trace += "Heap:" + e.sysInfo["mem.heap.used"] + "/" + e.sysInfo["mem.heap.total"] + str += " Host:" + e.SysInfo["host.name"] + " | " + str += "OS:" + e.SysInfo["host.os"] + " | " + str += "Arch:" + e.SysInfo["host.arch"] + " | " + str += "Lang:" + e.SysInfo["host.lang"] + " | " + str += "Mem:" + e.SysInfo["mem.used"] + "/" + e.SysInfo["mem.total"] + " | " + str += "Heap:" + e.SysInfo["mem.heap.used"] + "/" + e.SysInfo["mem.heap.total"] - return trace + return str } return "" } - -// JSON returns JSON formated error trace. -func (e *Error) JSON() string { - if e == nil || e.e == nil { - return "" - } - - e.lock.RLock() - defer e.lock.RUnlock() - - anonError := struct { - SysInfo map[string]string - TracePoints []tracePoint - }{ - e.sysInfo, - e.tracePoints, - } - - // jBytes, err := json.Marshal(anonError) - jBytes, err := json.MarshalIndent(anonError, "", "\t") - if err != nil { - return "" - } - return string(jBytes) -} - -// ToError returns original embedded error. -func (e *Error) ToError() error { - // No need to lock. "e.e" is set once during New and never changed. - return e.e -} - -// WrappedError implements container for *probe.Error -type WrappedError struct { - err *Error -} - -// NewWrappedError function wraps a *probe.Error into a 'error' compatible duck type -func NewWrappedError(err *Error) error { - return &WrappedError{err: err} -} - -// Error interface method -func (w *WrappedError) Error() string { - return w.err.String() -} - -// ToError get the *probe.Error embedded internally -func (w *WrappedError) ToError() *Error { - return w.err -} - -// ToWrappedError try to convert generic 'error' into typed *WrappedError, returns true if yes, false otherwise -func ToWrappedError(err error) (*WrappedError, bool) { - switch e := err.(type) { - case *WrappedError: - return e, true - default: - return nil, false - } -} diff --git a/internal/github.com/minio/minio/pkg/probe/wrapper.go b/internal/github.com/minio/minio/pkg/probe/wrapper.go new file mode 100644 index 00000000..817c2ad8 --- /dev/null +++ b/internal/github.com/minio/minio/pkg/probe/wrapper.go @@ -0,0 +1,43 @@ +/* + * Minimalist Object Storage, (C) 2015 Minio, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses)/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Package probe implements a simple mechanism to trace and return errors in large programs. +package probe + +// wrappedError implements a container for *probe.Error. +type wrappedError struct { + err *Error +} + +// WrapError function wraps a *probe.Error into a 'error' compatible duck type. +func WrapError(err *Error) error { + return &wrappedError{err: err} +} + +// UnwrapError tries to convert generic 'error' into typed *probe.Error and returns true, false otherwise. +func UnwrapError(err error) (*Error, bool) { + switch e := err.(type) { + case *wrappedError: + return e.err, true + default: + return nil, false + } +} + +// Error interface method. +func (w *wrappedError) Error() string { + return w.err.String() +} diff --git a/internal/vendor.json b/internal/vendor.json index 11c3e7b9..e3758f67 100755 --- a/internal/vendor.json +++ b/internal/vendor.json @@ -6,8 +6,8 @@ "canonical": "github.com/dustin/go-humanize", "comment": "", "local": "github.com/dustin/go-humanize", - "revision": "1c212aae1d02984808182b98b0da7a3e07e4c770", - "revisionTime": "2015-08-09T13:14:05-07:00" + "revision": "8789c5a49d3212d38ee42b36eec6eaeea45d6778", + "revisionTime": "2015-08-18T23:52:04-07:00" }, { "canonical": "github.com/fatih/color", @@ -20,15 +20,15 @@ "canonical": "github.com/fatih/structs", "comment": "", "local": "github.com/fatih/structs", - "revision": "a9f7daa9c2729e97450c2da2feda19130a367d8f", - "revisionTime": "2015-05-26T09:43:52+03:00" + "revision": "8789c5a49d3212d38ee42b36eec6eaeea45d6778", + "revisionTime": "2015-08-18T23:52:04-07:00" }, { "canonical": "github.com/mattn/go-isatty", "comment": "", "local": "github.com/mattn/go-isatty", - "revision": "ae0b1f8f8004be68d791a576e3d8e7648ab41449", - "revisionTime": "2015-04-09T09:42:43+09:00" + "revision": "7fcbc72f853b92b5720db4a6b8482be612daef24", + "revisionTime": "2015-08-14T09:26:29+09:00" }, { "canonical": "github.com/minio/cli", @@ -41,22 +41,22 @@ "canonical": "github.com/minio/minio-go", "comment": "", "local": "github.com/minio/minio-go", - "revision": "69b05646606fd39171e16d6bf4edc84bb77787e0", - "revisionTime": "2015-08-11T13:40:24-07:00" + "revision": "feda9e7303c21b33793ce0f8105e8884b5eee6b1", + "revisionTime": "2015-08-17T20:55:25-07:00" }, { "canonical": "github.com/minio/minio/pkg/probe", "comment": "", "local": "github.com/minio/minio/pkg/probe", - "revision": "76d11ed1e49fd7e15f4eb6b7d56c6113806c9497", - "revisionTime": "2015-08-13T16:35:03-07:00" + "revision": "8789c5a49d3212d38ee42b36eec6eaeea45d6778", + "revisionTime": "2015-08-18T23:52:04-07:00" }, { "canonical": "github.com/minio/minio/pkg/quick", "comment": "", "local": "github.com/minio/minio/pkg/quick", - "revision": "76d11ed1e49fd7e15f4eb6b7d56c6113806c9497", - "revisionTime": "2015-08-13T16:35:03-07:00" + "revision": "8789c5a49d3212d38ee42b36eec6eaeea45d6778", + "revisionTime": "2015-08-18T23:52:04-07:00" }, { "canonical": "github.com/minio/pb", diff --git a/ls.go b/ls.go index addbbe76..36e65501 100644 --- a/ls.go +++ b/ls.go @@ -76,13 +76,13 @@ func doList(clnt client.Client, recursive bool) *probe.Error { var err *probe.Error for contentCh := range clnt.List(recursive) { if contentCh.Err != nil { - switch contentCh.Err.ToError().(type) { + switch contentCh.Err.ToGoError().(type) { // handle this specifically for filesystem case client.ISBrokenSymlink: errorIf(contentCh.Err.Trace()) continue } - if os.IsNotExist(contentCh.Err.ToError()) || os.IsPermission(contentCh.Err.ToError()) { + if os.IsNotExist(contentCh.Err.ToGoError()) || os.IsPermission(contentCh.Err.ToGoError()) { errorIf(contentCh.Err.Trace()) continue } diff --git a/print-structs.go b/print-structs.go index b46f96b1..151e92f9 100644 --- a/print-structs.go +++ b/print-structs.go @@ -24,15 +24,16 @@ import ( "strings" "time" + "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe" "github.com/minio/mc/pkg/console" ) // ErrorMessage json container for error messages type ErrorMessage struct { - Type string `json:"type"` - TypedError string `json:"typed-error"` - EmbeddedError error `json:"embedded-error"` - ProbeError *json.RawMessage `json:"probe-error,omitempty"` + Type string `json:"type"` + TypedError string `json:"typed-error"` + EmbeddedError error `json:"embedded-error"` + ProbeError *probe.Error `json:"probe-error,omitempty"` } func (e ErrorMessage) String() string {