From 1b853021611d310c2358cae7119aa22fc0b5ed5e Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 15 Nov 2016 18:14:23 -0800 Subject: [PATCH] Fix spelling and golint errors. (#3266) Fixes #3263 --- cmd/bucket-policy-parser.go | 28 +++++++++--------- cmd/bucket-policy-parser_test.go | 50 ++++++++++++++++---------------- cmd/erasure-readfile.go | 2 +- cmd/format-config-v1.go | 6 ++-- cmd/format-config-v1_test.go | 2 +- cmd/fs-v1-errors.go | 2 +- cmd/lock-instrument.go | 10 +++---- cmd/namespace-lock.go | 14 ++++----- cmd/notify-elasticsearch.go | 2 +- cmd/notify-listener.go | 2 +- cmd/postpolicyform.go | 12 ++++---- cmd/prepare-storage.go | 6 ++-- cmd/signature-jwt.go | 8 ++--- cmd/test-utils_test.go | 18 ++++++------ cmd/typed-errors.go | 6 ++-- docs/configure-minio-with-tls.md | 3 +- pkg/quick/quick.go | 8 ++--- 17 files changed, 90 insertions(+), 89 deletions(-) diff --git a/cmd/bucket-policy-parser.go b/cmd/bucket-policy-parser.go index a3643aba7..36c179973 100644 --- a/cmd/bucket-policy-parser.go +++ b/cmd/bucket-policy-parser.go @@ -79,11 +79,11 @@ func (b bucketPolicy) String() string { func isValidActions(actions set.StringSet) (err error) { // Statement actions cannot be empty. if len(actions) == 0 { - err = errors.New("Action list cannot be empty.") + err = errors.New("Action list cannot be empty") return err } if unsupportedActions := actions.Difference(supportedActionMap); !unsupportedActions.IsEmpty() { - err = fmt.Errorf("Unsupported actions found: ‘%#v’, please validate your policy document.", unsupportedActions) + err = fmt.Errorf("Unsupported actions found: ‘%#v’, please validate your policy document", unsupportedActions) return err } return nil @@ -93,11 +93,11 @@ func isValidActions(actions set.StringSet) (err error) { func isValidEffect(effect string) (err error) { // Statement effect cannot be empty. if effect == "" { - err = errors.New("Policy effect cannot be empty.") + err = errors.New("Policy effect cannot be empty") return err } if !supportedEffectMap.Contains(effect) { - err = errors.New("Unsupported Effect found: ‘" + effect + "’, please validate your policy document.") + err = errors.New("Unsupported Effect found: ‘" + effect + "’, please validate your policy document") return err } return nil @@ -107,17 +107,17 @@ func isValidEffect(effect string) (err error) { func isValidResources(resources set.StringSet) (err error) { // Statement resources cannot be empty. if len(resources) == 0 { - err = errors.New("Resource list cannot be empty.") + err = errors.New("Resource list cannot be empty") return err } for resource := range resources { if !strings.HasPrefix(resource, AWSResourcePrefix) { - err = errors.New("Unsupported resource style found: ‘" + resource + "’, please validate your policy document.") + err = errors.New("Unsupported resource style found: ‘" + resource + "’, please validate your policy document") return err } resourceSuffix := strings.SplitAfter(resource, AWSResourcePrefix)[1] if len(resourceSuffix) == 0 || strings.HasPrefix(resourceSuffix, "/") { - err = errors.New("Invalid resource style found: ‘" + resource + "’, please validate your policy document.") + err = errors.New("Invalid resource style found: ‘" + resource + "’, please validate your policy document") return err } } @@ -171,13 +171,13 @@ func isValidPrincipals(principal interface{}) (err error) { principals := parsePrincipals(principal) // Statement principal should have a value. if len(principals) == 0 { - err = errors.New("Principal cannot be empty.") + err = errors.New("Principal cannot be empty") return err } if unsuppPrincipals := principals.Difference(set.CreateStringSet([]string{"*"}...)); !unsuppPrincipals.IsEmpty() { // Minio does not support or implement IAM, "*" is the only valid value. // Amazon s3 doc on principals: http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#Principal - err = fmt.Errorf("Unsupported principals found: ‘%#v’, please validate your policy document.", unsuppPrincipals) + err = fmt.Errorf("Unsupported principals found: ‘%#v’, please validate your policy document", unsuppPrincipals) return err } return nil @@ -191,17 +191,17 @@ func isValidConditions(conditions map[string]map[string]set.StringSet) (err erro conditionKeyVal := make(map[string]set.StringSet) for conditionType := range conditions { if !supportedConditionsType.Contains(conditionType) { - err = fmt.Errorf("Unsupported condition type '%s', please validate your policy document.", conditionType) + err = fmt.Errorf("Unsupported condition type '%s', please validate your policy document", conditionType) return err } for key, value := range conditions[conditionType] { if !supportedConditionsKey.Contains(key) { - err = fmt.Errorf("Unsupported condition key '%s', please validate your policy document.", conditionType) + err = fmt.Errorf("Unsupported condition key '%s', please validate your policy document", conditionType) return err } conditionVal, ok := conditionKeyVal[key] if ok && !value.Intersection(conditionVal).IsEmpty() { - err = fmt.Errorf("Ambigious condition values for key '%s', please validate your policy document.", key) + err = fmt.Errorf("Ambigious condition values for key '%s', please validate your policy document", key) return err } conditionKeyVal[key] = value @@ -293,13 +293,13 @@ func parseBucketPolicy(bucketPolicyReader io.Reader, policy *bucketPolicy) (err // Policy version cannot be empty. if len(policy.Version) == 0 { - err = errors.New("Policy version cannot be empty.") + err = errors.New("Policy version cannot be empty") return err } // Policy statements cannot be empty. if len(policy.Statements) == 0 { - err = errors.New("Policy statement cannot be empty.") + err = errors.New("Policy statement cannot be empty") return err } diff --git a/cmd/bucket-policy-parser_test.go b/cmd/bucket-policy-parser_test.go index ce25e15e6..e7fd82dab 100644 --- a/cmd/bucket-policy-parser_test.go +++ b/cmd/bucket-policy-parser_test.go @@ -184,14 +184,14 @@ func TestIsValidActions(t *testing.T) { // Test case - 1. // "s3:ListObject" is an invalid Action. {set.CreateStringSet([]string{"s3:GetObject", "s3:ListObject", "s3:RemoveObject"}...), - errors.New("Unsupported actions found: ‘set.StringSet{\"s3:RemoveObject\":struct {}{}, \"s3:ListObject\":struct {}{}}’, please validate your policy document."), false}, + errors.New("Unsupported actions found: ‘set.StringSet{\"s3:RemoveObject\":struct {}{}, \"s3:ListObject\":struct {}{}}’, please validate your policy document"), false}, // Test case - 2. // Empty Actions. - {set.CreateStringSet([]string{}...), errors.New("Action list cannot be empty."), false}, + {set.CreateStringSet([]string{}...), errors.New("Action list cannot be empty"), false}, // Test case - 3. // "s3:DeleteEverything"" is an invalid Action. {set.CreateStringSet([]string{"s3:GetObject", "s3:ListBucket", "s3:PutObject", "s3:DeleteEverything"}...), - errors.New("Unsupported actions found: ‘set.StringSet{\"s3:DeleteEverything\":struct {}{}}’, please validate your policy document."), false}, + errors.New("Unsupported actions found: ‘set.StringSet{\"s3:DeleteEverything\":struct {}{}}’, please validate your policy document"), false}, // Inputs with valid Action. // Test Case - 4. {set.CreateStringSet([]string{ @@ -223,13 +223,13 @@ func TestIsValidEffect(t *testing.T) { }{ // Inputs with unsupported Effect. // Test case - 1. - {"", errors.New("Policy effect cannot be empty."), false}, + {"", errors.New("Policy effect cannot be empty"), false}, // Test case - 2. - {"DontAllow", errors.New("Unsupported Effect found: ‘DontAllow’, please validate your policy document."), false}, + {"DontAllow", errors.New("Unsupported Effect found: ‘DontAllow’, please validate your policy document"), false}, // Test case - 3. - {"NeverAllow", errors.New("Unsupported Effect found: ‘NeverAllow’, please validate your policy document."), false}, + {"NeverAllow", errors.New("Unsupported Effect found: ‘NeverAllow’, please validate your policy document"), false}, // Test case - 4. - {"AllowAlways", errors.New("Unsupported Effect found: ‘AllowAlways’, please validate your policy document."), false}, + {"AllowAlways", errors.New("Unsupported Effect found: ‘AllowAlways’, please validate your policy document"), false}, // Inputs with valid Effect. // Test Case - 5. @@ -267,16 +267,16 @@ func TestIsValidResources(t *testing.T) { // Inputs with unsupported Action. // Test case - 1. // Empty Resources. - {[]string{}, errors.New("Resource list cannot be empty."), false}, + {[]string{}, errors.New("Resource list cannot be empty"), false}, // Test case - 2. // A valid resource should have prefix "arn:aws:s3:::". - {[]string{"my-resource"}, errors.New("Unsupported resource style found: ‘my-resource’, please validate your policy document."), false}, + {[]string{"my-resource"}, errors.New("Unsupported resource style found: ‘my-resource’, please validate your policy document"), false}, // Test case - 3. // A Valid resource should have bucket name followed by "arn:aws:s3:::". - {[]string{"arn:aws:s3:::"}, errors.New("Invalid resource style found: ‘arn:aws:s3:::’, please validate your policy document."), false}, + {[]string{"arn:aws:s3:::"}, errors.New("Invalid resource style found: ‘arn:aws:s3:::’, please validate your policy document"), false}, // Test Case - 4. // Valid resource shouldn't have slash('/') followed by "arn:aws:s3:::". - {[]string{"arn:aws:s3:::/"}, errors.New("Invalid resource style found: ‘arn:aws:s3:::/’, please validate your policy document."), false}, + {[]string{"arn:aws:s3:::/"}, errors.New("Invalid resource style found: ‘arn:aws:s3:::/’, please validate your policy document"), false}, // Test cases with valid Resources. {[]string{"arn:aws:s3:::my-bucket"}, nil, true}, @@ -313,12 +313,12 @@ func TestIsValidPrincipals(t *testing.T) { // Inputs with unsupported Principals. // Test case - 1. // Empty Principals list. - {[]string{}, errors.New("Principal cannot be empty."), false}, + {[]string{}, errors.New("Principal cannot be empty"), false}, // Test case - 2. // "*" is the only valid principal. - {[]string{"my-principal"}, errors.New("Unsupported principals found: ‘set.StringSet{\"my-principal\":struct {}{}}’, please validate your policy document."), false}, + {[]string{"my-principal"}, errors.New("Unsupported principals found: ‘set.StringSet{\"my-principal\":struct {}{}}’, please validate your policy document"), false}, // Test case - 3. - {[]string{"*", "111122233"}, errors.New("Unsupported principals found: ‘set.StringSet{\"111122233\":struct {}{}}’, please validate your policy document."), false}, + {[]string{"*", "111122233"}, errors.New("Unsupported principals found: ‘set.StringSet{\"111122233\":struct {}{}}’, please validate your policy document"), false}, // Test case - 4. // Test case with valid principal value. {[]string{"*"}, nil, true}, @@ -434,23 +434,23 @@ func TestIsValidConditions(t *testing.T) { // Test case - 1. // "StringValues" is an invalid type. {testConditions[0], fmt.Errorf("Unsupported condition type 'StringValues', " + - "please validate your policy document."), false}, + "please validate your policy document"), false}, // Test case - 2. // "s3:Object" is an invalid key. {testConditions[1], fmt.Errorf("Unsupported condition key " + - "'StringEquals', please validate your policy document."), false}, + "'StringEquals', please validate your policy document"), false}, // Test case - 3. // Test case with Ambigious conditions set. {testConditions[2], fmt.Errorf("Ambigious condition values for key 's3:prefix', " + - "please validate your policy document."), false}, + "please validate your policy document"), false}, // Test case - 4. // Test case with valid and invalid condition types. {testConditions[3], fmt.Errorf("Unsupported condition type 'InvalidType', " + - "please validate your policy document."), false}, + "please validate your policy document"), false}, // Test case - 5. // Test case with valid and invalid condition keys. {testConditions[4], fmt.Errorf("Unsupported condition key 'StringEquals', " + - "please validate your policy document."), false}, + "please validate your policy document"), false}, // Test cases with valid conditions. // Test case - 6. {testConditions[5], nil, true}, @@ -653,10 +653,10 @@ func TestParseBucketPolicy(t *testing.T) { }{ // Test case - 1. // bucketPolicy statement empty. - {bucketAccesPolicies[0], bucketPolicy{}, errors.New("Policy statement cannot be empty."), false}, + {bucketAccesPolicies[0], bucketPolicy{}, errors.New("Policy statement cannot be empty"), false}, // Test case - 2. // bucketPolicy version empty. - {bucketAccesPolicies[1], bucketPolicy{}, errors.New("Policy version cannot be empty."), false}, + {bucketAccesPolicies[1], bucketPolicy{}, errors.New("Policy version cannot be empty"), false}, // Test case - 3. // Readonly bucketPolicy. {bucketAccesPolicies[2], bucketAccesPolicies[2], nil, true}, @@ -668,16 +668,16 @@ func TestParseBucketPolicy(t *testing.T) { {bucketAccesPolicies[4], bucketAccesPolicies[4], nil, true}, // Test case - 6. // bucketPolicy statement contains unsupported action. - {bucketAccesPolicies[5], bucketAccesPolicies[5], fmt.Errorf("Unsupported actions found: ‘set.StringSet{\"s3:DeleteEverything\":struct {}{}}’, please validate your policy document."), false}, + {bucketAccesPolicies[5], bucketAccesPolicies[5], fmt.Errorf("Unsupported actions found: ‘set.StringSet{\"s3:DeleteEverything\":struct {}{}}’, please validate your policy document"), false}, // Test case - 7. // bucketPolicy statement contains unsupported Effect. - {bucketAccesPolicies[6], bucketAccesPolicies[6], fmt.Errorf("Unsupported Effect found: ‘DontAllow’, please validate your policy document."), false}, + {bucketAccesPolicies[6], bucketAccesPolicies[6], fmt.Errorf("Unsupported Effect found: ‘DontAllow’, please validate your policy document"), false}, // Test case - 8. // bucketPolicy statement contains unsupported Principal. - {bucketAccesPolicies[7], bucketAccesPolicies[7], fmt.Errorf("Unsupported principals found: ‘set.StringSet{\"User1111\":struct {}{}}’, please validate your policy document."), false}, + {bucketAccesPolicies[7], bucketAccesPolicies[7], fmt.Errorf("Unsupported principals found: ‘set.StringSet{\"User1111\":struct {}{}}’, please validate your policy document"), false}, // Test case - 9. // bucketPolicy statement contains unsupported Resource. - {bucketAccesPolicies[8], bucketAccesPolicies[8], fmt.Errorf("Unsupported resource style found: ‘my-resource’, please validate your policy document."), false}, + {bucketAccesPolicies[8], bucketAccesPolicies[8], fmt.Errorf("Unsupported resource style found: ‘my-resource’, please validate your policy document"), false}, } for i, testCase := range testCases { var buffer bytes.Buffer diff --git a/cmd/erasure-readfile.go b/cmd/erasure-readfile.go index 9f521eec6..6d50d933a 100644 --- a/cmd/erasure-readfile.go +++ b/cmd/erasure-readfile.go @@ -341,7 +341,7 @@ func decodeData(enBlocks [][]byte, dataBlocks, parityBlocks int) error { } if !ok { // Blocks cannot be reconstructed, corrupted data. - err = errors.New("Verification failed after reconstruction, data likely corrupted.") + err = errors.New("Verification failed after reconstruction, data likely corrupted") return traceError(err) } diff --git a/cmd/format-config-v1.go b/cmd/format-config-v1.go index cddf9f020..28f9c84d5 100644 --- a/cmd/format-config-v1.go +++ b/cmd/format-config-v1.go @@ -342,7 +342,7 @@ func checkJBODConsistency(formatConfigs []*formatConfigV1) error { } currentJBOD := format.XL.JBOD if !reflect.DeepEqual(sentinelJBOD, currentJBOD) { - return errors.New("Inconsistent JBOD found.") + return errors.New("Inconsistent JBOD found") } } return nil @@ -801,10 +801,10 @@ func checkFormatXL(formatConfigs []*formatConfigV1) error { } // Validate format version and format type. if formatXL.Version != "1" { - return fmt.Errorf("Unsupported version of backend format [%s] found.", formatXL.Version) + return fmt.Errorf("Unsupported version of backend format [%s] found", formatXL.Version) } if formatXL.Format != "xl" { - return fmt.Errorf("Unsupported backend format [%s] found.", formatXL.Format) + return fmt.Errorf("Unsupported backend format [%s] found", formatXL.Format) } if formatXL.XL.Version != "1" { return fmt.Errorf("Unsupported XL backend format found [%s]", formatXL.XL.Version) diff --git a/cmd/format-config-v1_test.go b/cmd/format-config-v1_test.go index 0790e1cee..64d171ce9 100644 --- a/cmd/format-config-v1_test.go +++ b/cmd/format-config-v1_test.go @@ -475,7 +475,7 @@ func TestFormatXLReorderByInspection(t *testing.T) { t.Fatal("should not be nil") } if orderedDisks[i] != nil && orderedDisks[i] != xl.storageDisks[i] { - t.Fatal("Disks were not ordered correctly.") + t.Fatal("Disks were not ordered correctly") } } diff --git a/cmd/fs-v1-errors.go b/cmd/fs-v1-errors.go index 19ff0a4f1..c506661a8 100644 --- a/cmd/fs-v1-errors.go +++ b/cmd/fs-v1-errors.go @@ -19,4 +19,4 @@ package cmd import "errors" // errFSDiskFormat - returned when given disk format is other than FS format. -var errFSDiskFormat = errors.New("Disk is not in FS format.") +var errFSDiskFormat = errors.New("Disk is not in FS format") diff --git a/cmd/lock-instrument.go b/cmd/lock-instrument.go index 9a1d35725..66d9ea6fd 100644 --- a/cmd/lock-instrument.go +++ b/cmd/lock-instrument.go @@ -84,7 +84,7 @@ type LockInfoOriginNotFound struct { } func (l LockInfoOriginNotFound) Error() string { - return fmt.Sprintf("No lock state stored for the lock origined at \"%s\", for %s, %s, %s.", + return fmt.Sprintf("No lock state stored for the lock origined at \"%s\", for %s, %s, %s", l.lockOrigin, l.volume, l.path, l.opsID) } @@ -95,7 +95,7 @@ type LockInfoVolPathMissing struct { } func (l LockInfoVolPathMissing) Error() string { - return fmt.Sprintf("No entry in debug Lock Map for Volume: %s, path: %s.", l.volume, l.path) + return fmt.Sprintf("No entry in debug Lock Map for Volume: %s, path: %s", l.volume, l.path) } // LockInfoOpsIDNotFound - Returned when the lock state info exists, but the entry for @@ -107,7 +107,7 @@ type LockInfoOpsIDNotFound struct { } func (l LockInfoOpsIDNotFound) Error() string { - return fmt.Sprintf("No entry in lock info for %s, %s, %s.", l.opsID, l.volume, l.path) + return fmt.Sprintf("No entry in lock info for %s, %s, %s", l.opsID, l.volume, l.path) } // LockInfoStateNotBlocked - When an attempt to change the state of the lock form `blocked` to `running` is done, @@ -119,10 +119,10 @@ type LockInfoStateNotBlocked struct { } func (l LockInfoStateNotBlocked) Error() string { - return fmt.Sprintf("Lock state should be \"Blocked\" for %s, %s, %s.", l.volume, l.path, l.opsID) + return fmt.Sprintf("Lock state should be \"Blocked\" for %s, %s, %s", l.volume, l.path, l.opsID) } -var errLockNotInitialized = errors.New("Debug lockMap not initialized.") +var errLockNotInitialized = errors.New("Debug lockMap not initialized") // Initialize lock info volume path. func (n *nsLockMap) initLockInfoForVolumePath(param nsParam) { diff --git a/cmd/namespace-lock.go b/cmd/namespace-lock.go index d4104e277..7e127b794 100644 --- a/cmd/namespace-lock.go +++ b/cmd/namespace-lock.go @@ -129,7 +129,7 @@ func (n *nsLockMap) lock(volume, path string, lockOrigin, opsID string, readLock // unblocks. The lock for accessing `nsMutex` is held inside // the function itself. if err := n.statusNoneToBlocked(param, lockOrigin, opsID, readLock); err != nil { - errorIf(err, "Failed to set lock state to blocked.") + errorIf(err, "Failed to set lock state to blocked") } // Unlock map before Locking NS which might block. @@ -146,7 +146,7 @@ func (n *nsLockMap) lock(volume, path string, lockOrigin, opsID string, readLock // running. change the state of the lock to be running (from // blocked) for the given pair of and . if err := n.statusBlockedToRunning(param, lockOrigin, opsID, readLock); err != nil { - errorIf(err, "Failed to set the lock state to running.") + errorIf(err, "Failed to set the lock state to running") } } @@ -165,8 +165,8 @@ func (n *nsLockMap) unlock(volume, path, opsID string, readLock bool) { nsLk.Unlock() } if nsLk.ref == 0 { - errorIf(errors.New("Namespace reference count cannot be 0."), - "Invalid reference count detected.") + errorIf(errors.New("Namespace reference count cannot be 0"), + "Invalid reference count detected") } if nsLk.ref != 0 { nsLk.ref-- @@ -174,7 +174,7 @@ func (n *nsLockMap) unlock(volume, path, opsID string, readLock bool) { // delete the lock state entry for given operation ID. err := n.deleteLockInfoEntryForOps(param, opsID) if err != nil { - errorIf(err, "Failed to delete lock info entry.") + errorIf(err, "Failed to delete lock info entry") } } if nsLk.ref == 0 { @@ -185,7 +185,7 @@ func (n *nsLockMap) unlock(volume, path, opsID string, readLock bool) { // pair. err := n.deleteLockInfoEntryForVolumePath(param) if err != nil { - errorIf(err, "Failed to delete lock info entry.") + errorIf(err, "Failed to delete lock info entry") } } } @@ -252,7 +252,7 @@ func (n *nsLockMap) ForceUnlock(volume, path string) { // pair. err := n.deleteLockInfoEntryForVolumePath(param) if err != nil { - errorIf(err, "Failed to delete lock info entry.") + errorIf(err, "Failed to delete lock info entry") } } } diff --git a/cmd/notify-elasticsearch.go b/cmd/notify-elasticsearch.go index 454f3c390..98249d16d 100644 --- a/cmd/notify-elasticsearch.go +++ b/cmd/notify-elasticsearch.go @@ -76,7 +76,7 @@ func newElasticNotify(accountID string) (*logrus.Logger, error) { return nil, err } if !createIndex.Acknowledged { - return nil, errors.New("Index not created.") + return nil, errors.New("Index not created") } } diff --git a/cmd/notify-listener.go b/cmd/notify-listener.go index d88cd9d79..816690a2e 100644 --- a/cmd/notify-listener.go +++ b/cmd/notify-listener.go @@ -38,7 +38,7 @@ func newListenerLogger(listenerArn, targetAddr string) (*listenerLogger, error) bmsClient := globalS3Peers.GetPeerClient(targetAddr) if bmsClient == nil { return nil, fmt.Errorf( - "Peer %s was not initialized - bug!", + "Peer %s was not initialized, unexpected error", targetAddr, ) } diff --git a/cmd/postpolicyform.go b/cmd/postpolicyform.go index 26d18e17a..fe669b18b 100644 --- a/cmd/postpolicyform.go +++ b/cmd/postpolicyform.go @@ -103,7 +103,7 @@ func parsePostPolicyForm(policy string) (PostPolicyForm, error) { for k, v := range condt { if !isString(v) { // Pre-check value type. // All values must be of type string. - return parsedPolicy, fmt.Errorf("Unknown type %s of conditional field value %s found in POST policy form.", reflect.TypeOf(condt).String(), condt) + return parsedPolicy, fmt.Errorf("Unknown type %s of conditional field value %s found in POST policy form", reflect.TypeOf(condt).String(), condt) } // {"acl": "public-read" } is an alternate way to indicate - [ "eq", "$acl", "public-read" ] // In this case we will just collapse this into "eq" for all use cases. @@ -117,14 +117,14 @@ func parsePostPolicyForm(policy string) (PostPolicyForm, error) { } case []interface{}: // Handle array types. if len(condt) != 3 { // Return error if we have insufficient elements. - return parsedPolicy, fmt.Errorf("Malformed conditional fields %s of type %s found in POST policy form.", condt, reflect.TypeOf(condt).String()) + return parsedPolicy, fmt.Errorf("Malformed conditional fields %s of type %s found in POST policy form", condt, reflect.TypeOf(condt).String()) } switch toString(condt[0]) { case "eq", "starts-with": for _, v := range condt { // Pre-check all values for type. if !isString(v) { // All values must be of type string. - return parsedPolicy, fmt.Errorf("Unknown type %s of conditional field value %s found in POST policy form.", reflect.TypeOf(condt).String(), condt) + return parsedPolicy, fmt.Errorf("Unknown type %s of conditional field value %s found in POST policy form", reflect.TypeOf(condt).String(), condt) } } operator, matchType, value := toString(condt[0]), toString(condt[1]), toString(condt[2]) @@ -139,10 +139,12 @@ func parsePostPolicyForm(policy string) (PostPolicyForm, error) { parsedPolicy.Conditions.ContentLengthRange = contentLengthRange{toInteger(condt[1]), toInteger(condt[2]), true} default: // Condition should be valid. - return parsedPolicy, fmt.Errorf("Unknown type %s of conditional field value %s found in POST policy form.", reflect.TypeOf(condt).String(), condt) + return parsedPolicy, fmt.Errorf("Unknown type %s of conditional field value %s found in POST policy form", + reflect.TypeOf(condt).String(), condt) } default: - return parsedPolicy, fmt.Errorf("Unknown field %s of type %s found in POST policy form.", condt, reflect.TypeOf(condt).String()) + return parsedPolicy, fmt.Errorf("Unknown field %s of type %s found in POST policy form", + condt, reflect.TypeOf(condt).String()) } } return parsedPolicy, nil diff --git a/cmd/prepare-storage.go b/cmd/prepare-storage.go index d1c26891b..9cf9e51fe 100644 --- a/cmd/prepare-storage.go +++ b/cmd/prepare-storage.go @@ -247,9 +247,9 @@ func retryFormattingDisks(firstDisk bool, endpoints []*url.URL, storageDisks []S // Print configuration errors. printConfigErrMsg(storageDisks, sErrs, printOnceFn()) case WaitForAll: - console.Println("Initializing data volume for first time. Waiting for other servers to come online.") + console.Println("Initializing data volume for first time. Waiting for other servers to come online") case WaitForFormatting: - console.Println("Initializing data volume for first time. Waiting for first server to come online.") + console.Println("Initializing data volume for first time. Waiting for first server to come online") } continue } // else We have FS backend now. Check fs format as well now. @@ -260,7 +260,7 @@ func retryFormattingDisks(firstDisk bool, endpoints []*url.URL, storageDisks []S } // else initialize the format for FS. return initFormatFS(storageDisks[0]) case <-globalServiceDoneCh: - return errors.New("Initializing data volumes gracefully stopped.") + return errors.New("Initializing data volumes gracefully stopped") } } } diff --git a/cmd/signature-jwt.go b/cmd/signature-jwt.go index a61f07280..a4e0278f7 100644 --- a/cmd/signature-jwt.go +++ b/cmd/signature-jwt.go @@ -58,8 +58,8 @@ func newJWT(expiry time.Duration) (*JWT, error) { return &JWT{cred, expiry}, nil } -var errInvalidAccessKeyLength = errors.New("Invalid access key, access key should be 5 to 20 characters in length.") -var errInvalidSecretKeyLength = errors.New("Invalid secret key, secret key should be 8 to 40 characters in length.") +var errInvalidAccessKeyLength = errors.New("Invalid access key, access key should be 5 to 20 characters in length") +var errInvalidSecretKeyLength = errors.New("Invalid secret key, secret key should be 8 to 40 characters in length") // GenerateToken - generates a new Json Web Token based on the incoming access key. func (jwt *JWT) GenerateToken(accessKey string) (string, error) { @@ -80,8 +80,8 @@ func (jwt *JWT) GenerateToken(accessKey string) (string, error) { return token.SignedString([]byte(jwt.SecretAccessKey)) } -var errInvalidAccessKeyID = errors.New("The access key ID you provided does not exist in our records.") -var errAuthentication = errors.New("Authentication failed, check your access credentials.") +var errInvalidAccessKeyID = errors.New("The access key ID you provided does not exist in our records") +var errAuthentication = errors.New("Authentication failed, check your access credentials") // Authenticate - authenticates incoming access key and secret key. func (jwt *JWT) Authenticate(accessKey, secretKey string) error { diff --git a/cmd/test-utils_test.go b/cmd/test-utils_test.go index 77dea3e4c..7ea72b799 100644 --- a/cmd/test-utils_test.go +++ b/cmd/test-utils_test.go @@ -544,7 +544,7 @@ func signStreamingRequest(req *http.Request, accessKey, secretKey string, currTi // Get hashed payload. hashedPayload := req.Header.Get("x-amz-content-sha256") if hashedPayload == "" { - return "", fmt.Errorf("Invalid hashed payload.") + return "", fmt.Errorf("Invalid hashed payload") } // Set x-amz-date. @@ -933,7 +933,7 @@ func signRequestV4(req *http.Request, accessKey, secretKey string) error { // Get hashed payload. hashedPayload := req.Header.Get("x-amz-content-sha256") if hashedPayload == "" { - return fmt.Errorf("Invalid hashed payload.") + return fmt.Errorf("Invalid hashed payload") } currTime := time.Now().UTC() @@ -1678,7 +1678,7 @@ func ExecObjectLayerAPIAnonTest(t *testing.T, testName, bucketName, objectName, // simple function which ends the test by printing the common message which gives the context of the test // and then followed by the the actual error message. failTest := func(testType, failMsg string) { - t.Fatalf("Minio %s: %s fail for \"%s\": \n %s.", instanceType, testType, testName, failMsg) + t.Fatalf("Minio %s: %s fail for \"%s\": \n %s", instanceType, testType, testName, failMsg) } // httptest Recorder to capture all the response by the http handler. rec := httptest.NewRecorder() @@ -1702,7 +1702,7 @@ func ExecObjectLayerAPIAnonTest(t *testing.T, testName, bucketName, objectName, // expected error response when the unsigned HTTP request is not permitted. accesDeniedHTTPStatus := getAPIError(ErrAccessDenied).HTTPStatusCode if rec.Code != accesDeniedHTTPStatus { - failTest(anonTestStr, fmt.Sprintf("Object API Nil Test expected to fail with %d, but failed with %d.", accesDeniedHTTPStatus, rec.Code)) + failTest(anonTestStr, fmt.Sprintf("Object API Nil Test expected to fail with %d, but failed with %d", accesDeniedHTTPStatus, rec.Code)) } // expected error response in bytes when objectLayer is not initialized, or set to `nil`. @@ -1749,7 +1749,7 @@ func ExecObjectLayerAPIAnonTest(t *testing.T, testName, bucketName, objectName, // compare the HTTP response status code with the expected one. if rec.Code != expectedHTTPStatus { - failTest(anonTestStr, fmt.Sprintf("Expected the anonymous HTTP request to be served after the policy changes\n,Expected response HTTP status code to be %d, got %d.", + failTest(anonTestStr, fmt.Sprintf("Expected the anonymous HTTP request to be served after the policy changes\n,Expected response HTTP status code to be %d, got %d", expectedHTTPStatus, rec.Code)) } @@ -1777,7 +1777,7 @@ func ExecObjectLayerAPIAnonTest(t *testing.T, testName, bucketName, objectName, } if rec.Code != accesDeniedHTTPStatus { - failTest(unknownSignTestStr, fmt.Sprintf("Object API Unknow auth test for \"%s\", expected to fail with %d, but failed with %d.", testName, accesDeniedHTTPStatus, rec.Code)) + failTest(unknownSignTestStr, fmt.Sprintf("Object API Unknow auth test for \"%s\", expected to fail with %d, but failed with %d", testName, accesDeniedHTTPStatus, rec.Code)) } } @@ -1805,7 +1805,7 @@ func ExecObjectLayerAPINilTest(t TestErrHandler, bucketName, objectName, instanc // or when objectLayer is `nil`. serverNotInitializedErr := getAPIError(ErrServerNotInitialized).HTTPStatusCode if rec.Code != serverNotInitializedErr { - t.Errorf("Object API Nil Test expected to fail with %d, but failed with %d.", serverNotInitializedErr, rec.Code) + t.Errorf("Object API Nil Test expected to fail with %d, but failed with %d", serverNotInitializedErr, rec.Code) } // expected error response in bytes when objectLayer is not initialized, or set to `nil`. expectedErrResponse := encodeResponse(getAPIErrorResponse(getAPIError(ErrServerNotInitialized), getGetObjectURL("", bucketName, objectName))) @@ -1816,11 +1816,11 @@ func ExecObjectLayerAPINilTest(t TestErrHandler, bucketName, objectName, instanc // read the response body. actualContent, err := ioutil.ReadAll(rec.Body) if err != nil { - t.Fatalf("Minio %s: Failed parsing response body: %v.", instanceType, err) + t.Fatalf("Minio %s: Failed parsing response body: %v", instanceType, err) } // verify whether actual error response (from the response body), matches the expected error response. if !bytes.Equal(expectedErrResponse, actualContent) { - t.Errorf("Minio %s: Object content differs from expected value.", instanceType) + t.Errorf("Minio %s: Object content differs from expected value", instanceType) } } } diff --git a/cmd/typed-errors.go b/cmd/typed-errors.go index 1b2710ae9..a2b950f50 100644 --- a/cmd/typed-errors.go +++ b/cmd/typed-errors.go @@ -43,10 +43,10 @@ var errDataTooLarge = errors.New("Object size larger than allowed limit") var errDataTooSmall = errors.New("Object size smaller than expected") // errServerNotInitialized - server not initialized. -var errServerNotInitialized = errors.New("Server not initialized, please try again.") +var errServerNotInitialized = errors.New("Server not initialized, please try again") // errServerVersionMismatch - server versions do not match. -var errServerVersionMismatch = errors.New("Server versions do not match.") +var errServerVersionMismatch = errors.New("Server versions do not match") // errServerTimeMismatch - server times are too far apart. -var errServerTimeMismatch = errors.New("Server times are too far apart.") +var errServerTimeMismatch = errors.New("Server times are too far apart") diff --git a/docs/configure-minio-with-tls.md b/docs/configure-minio-with-tls.md index b157310b6..fcdeddb57 100644 --- a/docs/configure-minio-with-tls.md +++ b/docs/configure-minio-with-tls.md @@ -42,8 +42,7 @@ To make Minio aware about your generated key and certificate, you will need to p ## 4. Install third parties CAs -Minio can be configured to connect to other servers, whether Minio nodes or servers like NATs, Redis... If these servers use certificates that are not registerd in one of the known certificates authorities, you can make your Minio trusts them by putting these certificates under `certs/CAs/` in your Minio config path. - +Minio can be configured to connect to other servers, whether Minio nodes or servers like NATs, Redis. If these servers use certificates that are not registered in one of the known certificates authorities, you can make Minio server trust these CAs by dropping these certificates under `~/.minio/certs/CAs/` in your Minio config path. # Explore Further * [Minio Quickstart Guide](https://docs.minio.io/docs/minio-quickstart-guide) diff --git a/pkg/quick/quick.go b/pkg/quick/quick.go index 691dca569..82a8b66b0 100644 --- a/pkg/quick/quick.go +++ b/pkg/quick/quick.go @@ -54,17 +54,17 @@ type config struct { // type struct and contain a string type field called "Version". func CheckData(data interface{}) error { if !structs.IsStruct(data) { - return fmt.Errorf("Invalid argument type. Expecing \"struct\" type.") + return fmt.Errorf("Invalid argument type. Expecing \"struct\" type") } st := structs.New(data) f, ok := st.FieldOk("Version") if !ok { - return fmt.Errorf("Invalid type of struct argument. No [%s.Version] field found.", st.Name()) + return fmt.Errorf("Invalid type of struct argument. No [%s.Version] field found", st.Name()) } if f.Kind() != reflect.String { - return fmt.Errorf("Invalid type of struct argument. Expecting \"string\" type [%s.Version] field.", st.Name()) + return fmt.Errorf("Invalid type of struct argument. Expecting \"string\" type [%s.Version] field", st.Name()) } return nil @@ -258,7 +258,7 @@ func (d *config) Load(filename string) error { st := structs.New(d.data) f, ok := st.FieldOk("Version") if !ok { - return fmt.Errorf("Argument struct [%s] does not contain field \"Version\".", st.Name()) + return fmt.Errorf("Argument struct [%s] does not contain field \"Version\"", st.Name()) } err = json.Unmarshal(fileData, d.data)