summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/minio/minio-go/pkg
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-04-24 20:11:36 -0400
committerJoram Wilander <jwawilander@gmail.com>2017-04-24 20:11:36 -0400
commitf5437632f486b7d0a0a181c58f113c86d032b02c (patch)
tree407388e3003a210a89f4b2128d7ad656f8b79d26 /vendor/github.com/minio/minio-go/pkg
parent7f68a60f8c228d5604e0566bf84cabb145d16c37 (diff)
downloadchat-f5437632f486b7d0a0a181c58f113c86d032b02c.tar.gz
chat-f5437632f486b7d0a0a181c58f113c86d032b02c.tar.bz2
chat-f5437632f486b7d0a0a181c58f113c86d032b02c.zip
Upgrading server dependancies (#6215)
Diffstat (limited to 'vendor/github.com/minio/minio-go/pkg')
-rw-r--r--vendor/github.com/minio/minio-go/pkg/s3utils/utils.go12
-rw-r--r--vendor/github.com/minio/minio-go/pkg/set/stringset.go8
-rw-r--r--vendor/github.com/minio/minio-go/pkg/set/stringset_test.go25
3 files changed, 29 insertions, 16 deletions
diff --git a/vendor/github.com/minio/minio-go/pkg/s3utils/utils.go b/vendor/github.com/minio/minio-go/pkg/s3utils/utils.go
index ae1cea337..a3b6ed845 100644
--- a/vendor/github.com/minio/minio-go/pkg/s3utils/utils.go
+++ b/vendor/github.com/minio/minio-go/pkg/s3utils/utils.go
@@ -85,10 +85,6 @@ func IsAmazonEndpoint(endpointURL url.URL) bool {
return true
}
- if IsAmazonS3AccelerateEndpoint(endpointURL) {
- return true
- }
-
return endpointURL.Host == "s3.amazonaws.com"
}
@@ -105,14 +101,6 @@ func IsAmazonChinaEndpoint(endpointURL url.URL) bool {
return endpointURL.Host == "s3.cn-north-1.amazonaws.com.cn"
}
-// IsAmazonS3AccelerateEndpoint - Match if it is an Amazon S3 Accelerate
-func IsAmazonS3AccelerateEndpoint(endpointURL url.URL) bool {
- if endpointURL == sentinelURL {
- return false
- }
- return endpointURL.Host == "s3-accelerate.amazonaws.com"
-}
-
// IsGoogleEndpoint - Match if it is exactly Google cloud storage endpoint.
func IsGoogleEndpoint(endpointURL url.URL) bool {
if endpointURL == sentinelURL {
diff --git a/vendor/github.com/minio/minio-go/pkg/set/stringset.go b/vendor/github.com/minio/minio-go/pkg/set/stringset.go
index 55084d461..9f33488e0 100644
--- a/vendor/github.com/minio/minio-go/pkg/set/stringset.go
+++ b/vendor/github.com/minio/minio-go/pkg/set/stringset.go
@@ -25,8 +25,8 @@ import (
// StringSet - uses map as set of strings.
type StringSet map[string]struct{}
-// keys - returns StringSet keys.
-func (set StringSet) keys() []string {
+// ToSlice - returns StringSet as string slice.
+func (set StringSet) ToSlice() []string {
keys := make([]string, 0, len(set))
for k := range set {
keys = append(keys, k)
@@ -141,7 +141,7 @@ func (set StringSet) Union(sset StringSet) StringSet {
// MarshalJSON - converts to JSON data.
func (set StringSet) MarshalJSON() ([]byte, error) {
- return json.Marshal(set.keys())
+ return json.Marshal(set.ToSlice())
}
// UnmarshalJSON - parses JSON data and creates new set with it.
@@ -169,7 +169,7 @@ func (set *StringSet) UnmarshalJSON(data []byte) error {
// String - returns printable string of the set.
func (set StringSet) String() string {
- return fmt.Sprintf("%s", set.keys())
+ return fmt.Sprintf("%s", set.ToSlice())
}
// NewStringSet - creates new string set.
diff --git a/vendor/github.com/minio/minio-go/pkg/set/stringset_test.go b/vendor/github.com/minio/minio-go/pkg/set/stringset_test.go
index 4b74e7065..e276fec5a 100644
--- a/vendor/github.com/minio/minio-go/pkg/set/stringset_test.go
+++ b/vendor/github.com/minio/minio-go/pkg/set/stringset_test.go
@@ -17,6 +17,7 @@
package set
import (
+ "fmt"
"strings"
"testing"
)
@@ -320,3 +321,27 @@ func TestStringSetString(t *testing.T) {
}
}
}
+
+// StringSet.ToSlice() is called with series of cases for valid and erroneous inputs and the result is validated.
+func TestStringSetToSlice(t *testing.T) {
+ testCases := []struct {
+ set StringSet
+ expectedResult string
+ }{
+ // Test empty set.
+ {NewStringSet(), `[]`},
+ // Test set with empty value.
+ {CreateStringSet(""), `[]`},
+ // Test set with value.
+ {CreateStringSet("foo"), `[foo]`},
+ // Test set with value.
+ {CreateStringSet("foo", "bar"), `[bar foo]`},
+ }
+
+ for _, testCase := range testCases {
+ sslice := testCase.set.ToSlice()
+ if str := fmt.Sprintf("%s", sslice); str != testCase.expectedResult {
+ t.Fatalf("expected: %s, got: %s", testCase.expectedResult, str)
+ }
+ }
+}