Update all dependencies

This commit is contained in:
Harshavardhana
2015-06-08 01:44:57 -07:00
parent 6c7dbcaf4e
commit 58d832bcd0
10 changed files with 102 additions and 78 deletions
+2 -2
View File
@@ -15,7 +15,7 @@
},
{
"ImportPath": "github.com/fatih/structs",
"Rev": "c06d8730d42f16f3e8dddc236c7d69c0952a8a2c"
"Rev": "c00d27128bb88e9c1adab1a53cda9c72c6d1ff9b"
},
{
"ImportPath": "github.com/minio/check",
@@ -28,7 +28,7 @@
},
{
"ImportPath": "github.com/minio/minio-go",
"Rev": "745daad6222582eb6ecbb864f0cbcdc4427dd52f"
"Rev": "dee5d16f0c4515ddb2785a1b8317ec11796d8fc3"
},
{
"ImportPath": "github.com/minio/minio/pkg/iodine",
+2 -2
View File
@@ -33,7 +33,7 @@ func Comma(v int64) string {
j--
}
parts[j] = strconv.Itoa(int(v))
return sign + strings.Join(parts[j:], ",")
return sign + strings.Join(parts[j:len(parts)], ",")
}
// Commaf produces a string form of the given number in base 10 with
@@ -97,5 +97,5 @@ func BigComma(b *big.Int) string {
j--
}
parts[j] = strconv.Itoa(int(b.Int64()))
return sign + strings.Join(parts[j:], ",")
return sign + strings.Join(parts[j:len(parts)], ",")
}
-5
View File
@@ -43,10 +43,6 @@ m := structs.Map(server)
// => ["gopher", 123456, true]
v := structs.Values(server)
// Convert the names of a struct to a []string
// (see "Names methods" for more info about fields)
n := structs.Names(server)
// Convert the values of a struct to a []*Field
// (see "Field methods" for more info about fields)
f := structs.Fields(server)
@@ -77,7 +73,6 @@ s := structs.New(server)
m := s.Map() // Get a map[string]interface{}
v := s.Values() // Get a []interface{}
f := s.Fields() // Get a []*Field
n := s.Names() // Get a []string
f := s.Field(name) // Get a *Field based on the given field name
f, ok := s.FieldsOk(name) // Get a *Field based on the given field name
n := s.Name() // Get the struct name
-25
View File
@@ -171,25 +171,6 @@ func (s *Struct) Fields() []*Field {
return getFields(s.value, s.TagName)
}
// Names returns a slice of field names. A struct tag with the content of "-"
// ignores the checking of that particular field. Example:
//
// // Field is ignored by this package.
// Field bool `structs:"-"`
//
// It panics if s's kind is not struct.
func (s *Struct) Names() []string {
fields := getFields(s.value, s.TagName)
names := make([]string, len(fields))
for i, field := range fields {
names[i] = field.Name()
}
return names
}
func getFields(v reflect.Value, tagName string) []*Field {
if v.Kind() == reflect.Ptr {
v = v.Elem()
@@ -406,12 +387,6 @@ func Fields(s interface{}) []*Field {
return New(s).Fields()
}
// Names returns a slice of field names. For more info refer to Struct types
// Names() method. It panics if s's kind is not struct.
func Names(s interface{}) []string {
return New(s).Names()
}
// IsZero returns true if all fields is equal to a zero value. For more info
// refer to Struct types IsZero() method. It panics if s's kind is not struct.
func IsZero(s interface{}) bool {
-33
View File
@@ -442,39 +442,6 @@ func TestValues_Anonymous(t *testing.T) {
}
}
func TestNames(t *testing.T) {
var T = struct {
A string
B int
C bool
}{
A: "a-value",
B: 2,
C: true,
}
s := Names(T)
if len(s) != 3 {
t.Errorf("Names should return a slice of len 3, got: %d", len(s))
}
inSlice := func(val string) bool {
for _, v := range s {
if reflect.DeepEqual(v, val) {
return true
}
}
return false
}
for _, val := range []string{"A", "B", "C"} {
if !inSlice(val) {
t.Errorf("Names should have the value %v", val)
}
}
}
func TestFields(t *testing.T) {
var T = struct {
A string
+3 -3
View File
@@ -89,7 +89,7 @@ func TestBucketOperations(t *testing.T) {
if err == nil {
t.Errorf("Error")
}
if err.Error() != "403 Forbidden" {
if err.Error() != "Access Denied" {
t.Errorf("Error")
}
@@ -133,7 +133,7 @@ func TestBucketOperations(t *testing.T) {
if err == nil {
t.Fatalf("Error")
}
if err.Error() != "404 Not Found" {
if err.Error() != "The specified bucket does not exist." {
t.Errorf("Error")
}
}
@@ -191,7 +191,7 @@ func TestObjectOperations(t *testing.T) {
if err == nil {
t.Fatalf("Error")
}
if err.Error() != "404 Not Found" {
if err.Error() != "The specified key does not exist." {
t.Errorf("Error")
}
}
+73 -6
View File
@@ -335,7 +335,24 @@ func (a lowLevelAPI) headBucket(bucket string) error {
if resp != nil {
if resp.StatusCode != http.StatusOK {
// Head has no response body, handle it
return fmt.Errorf("%s", resp.Status)
var errorResponse ErrorResponse
switch {
case resp.StatusCode == http.StatusNotFound:
errorResponse = ErrorResponse{
Code: "NoSuchBucket",
Message: "The specified bucket does not exist.",
Resource: "/" + bucket,
RequestID: resp.Header.Get("x-amz-request-id"),
}
case resp.StatusCode == http.StatusForbidden:
errorResponse = ErrorResponse{
Code: "AccessDenied",
Message: "Access Denied",
Resource: "/" + bucket,
RequestID: resp.Header.Get("x-amz-request-id"),
}
}
return errorResponse
}
}
return nil
@@ -367,8 +384,24 @@ func (a lowLevelAPI) deleteBucket(bucket string) error {
defer resp.Body.Close()
if resp != nil {
if resp.StatusCode != http.StatusOK {
// Head has no response body, handle it
return fmt.Errorf("%s", resp.Status)
var errorResponse ErrorResponse
switch {
case resp.StatusCode == http.StatusNotFound:
errorResponse = ErrorResponse{
Code: "NoSuchBucket",
Message: "The specified bucket does not exist.",
Resource: "/" + bucket,
RequestID: resp.Header.Get("x-amz-request-id"),
}
case resp.StatusCode == http.StatusForbidden:
errorResponse = ErrorResponse{
Code: "AccessDenied",
Message: "Access Denied",
Resource: "/" + bucket,
RequestID: resp.Header.Get("x-amz-request-id"),
}
}
return errorResponse
}
}
return nil
@@ -512,7 +545,24 @@ func (a lowLevelAPI) deleteObject(bucket, object string) error {
defer resp.Body.Close()
if resp != nil {
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("%s", resp.Status)
var errorResponse ErrorResponse
switch {
case resp.StatusCode == http.StatusNotFound:
errorResponse = ErrorResponse{
Code: "NoSuchKey",
Message: "The specified key does not exist.",
Resource: "/" + bucket + "/" + object,
RequestID: resp.Header.Get("x-amz-request-id"),
}
case resp.StatusCode == http.StatusForbidden:
errorResponse = ErrorResponse{
Code: "AccessDenied",
Message: "Access Denied",
Resource: "/" + bucket + "/" + object,
RequestID: resp.Header.Get("x-amz-request-id"),
}
}
return errorResponse
}
}
return nil
@@ -545,7 +595,24 @@ func (a lowLevelAPI) headObject(bucket, object string) (ObjectStat, error) {
defer resp.Body.Close()
if resp != nil {
if resp.StatusCode != http.StatusOK {
return ObjectStat{}, fmt.Errorf("%s", resp.Status)
var errorResponse ErrorResponse
switch {
case resp.StatusCode == http.StatusNotFound:
errorResponse = ErrorResponse{
Code: "NoSuchKey",
Message: "The specified key does not exist.",
Resource: "/" + bucket + "/" + object,
RequestID: resp.Header.Get("x-amz-request-id"),
}
case resp.StatusCode == http.StatusForbidden:
errorResponse = ErrorResponse{
Code: "AccessDenied",
Message: "Access Denied",
Resource: "/" + bucket + "/" + object,
RequestID: resp.Header.Get("x-amz-request-id"),
}
}
return ObjectStat{}, errorResponse
}
}
md5sum := strings.Trim(resp.Header.Get("ETag"), "\"") // trim off the odd double quotes
@@ -594,7 +661,7 @@ func (a lowLevelAPI) listBuckets() (listAllMyBucketsResult, error) {
if resp != nil {
// for un-authenticated requests, amazon sends a redirect handle it
if resp.StatusCode == http.StatusTemporaryRedirect {
return listAllMyBucketsResult{}, fmt.Errorf("%s", resp.Status)
return listAllMyBucketsResult{}, errors.New(resp.Status)
}
if resp.StatusCode != http.StatusOK {
return listAllMyBucketsResult{}, responseToError(resp.Body)
+18 -1
View File
@@ -230,7 +230,24 @@ func (a lowLevelAPI) abortMultipartUpload(bucket, object, uploadID string) error
if resp != nil {
if resp.StatusCode != http.StatusNoContent {
// Abort has no response body, handle it
return fmt.Errorf("%s", resp.Status)
var errorResponse ErrorResponse
switch {
case resp.StatusCode == http.StatusNotFound:
errorResponse = ErrorResponse{
Code: "NoSuchUpload",
Message: "The specified multipart upload does not exist.",
Resource: "/" + bucket + "/" + object,
RequestID: resp.Header.Get("x-amz-request-id"),
}
case resp.StatusCode == http.StatusForbidden:
errorResponse = ErrorResponse{
Code: "AccessDenied",
Message: "Access Denied",
Resource: "/" + bucket + "/" + object,
RequestID: resp.Header.Get("x-amz-request-id"),
}
}
return errorResponse
}
}
return resp.Body.Close()
+1 -1
View File
@@ -308,7 +308,7 @@ func (cw *ansiColorWriter) Write(p []byte) (int, error) {
}
if cw.state == outsideCsiCode {
nw, err = cw.w.Write(p[first:])
nw, err = cw.w.Write(p[first:len(p)])
}
return r + nw + nc, err
+3
View File
@@ -51,6 +51,9 @@ release: getdeps verifiers
@go run make.go install
@mkdir -p $(HOME)/.mc
godepupdate:
@for i in $(grep ImportPath Godeps/Godeps.json | grep -v minio/mc | cut -f2 -d: | sed -e 's/,//' -e 's/^[ \t]*//' -e 's/[ \t]*$//' -e 's/\"//g'); do godep update $i; done
save:
@godep save ./...