From 45b32d398513b366e653c92c82a13e72ac5c11d8 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Fri, 23 Mar 2018 07:52:55 +0100 Subject: [PATCH] errors: Add missing ending dot in error & fatal messages (#2418) --- cmd/admin-credentials.go | 2 +- cmd/admin-heal-ui.go | 4 ++-- cmd/cat-main.go | 2 +- cmd/certs.go | 2 +- cmd/config-host-add.go | 4 ++-- cmd/config-host-list.go | 2 +- cmd/cp-main.go | 2 +- cmd/events-remove.go | 2 +- cmd/find.go | 10 +++++----- cmd/mirror-main.go | 16 ++++++++-------- cmd/pipe-main.go | 2 +- cmd/policy-main.go | 2 +- cmd/rm-main.go | 2 +- cmd/stat-main.go | 2 +- cmd/update-main.go | 4 ++-- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/cmd/admin-credentials.go b/cmd/admin-credentials.go index 3ba7b3b9..ce52829f 100644 --- a/cmd/admin-credentials.go +++ b/cmd/admin-credentials.go @@ -75,7 +75,7 @@ func mainAdminCreds(ctx *cli.Context) error { // Change the credentials of the specified Minio server e := client.SetCredentials(accessKey, secretKey) - fatalIf(probe.NewError(e), "Unable to set new credentials to '"+aliasedURL+"'") + fatalIf(probe.NewError(e), "Unable to set new credentials to '"+aliasedURL+"'.") return nil } diff --git a/cmd/admin-heal-ui.go b/cmd/admin-heal-ui.go index c365ca94..2f9bc194 100644 --- a/cmd/admin-heal-ui.go +++ b/cmd/admin-heal-ui.go @@ -297,7 +297,7 @@ func (ui *uiData) printItemsJSON(s *madmin.HealTaskStatus) (err error) { return err } jsonBytes, err := json.Marshal(r) - fatalIf(probe.NewError(err), "Unable to marshal to JSON") + fatalIf(probe.NewError(err), "Unable to marshal to JSON.") console.Println(string(jsonBytes)) } return nil @@ -327,7 +327,7 @@ func (ui *uiData) printStatsJSON(s *madmin.HealTaskStatus) { summary.ElapsedTime = int64(ui.HealDuration.Round(time.Second).Seconds()) jBytes, err := json.Marshal(summary) - fatalIf(probe.NewError(err), "Unable to marshal to JSON") + fatalIf(probe.NewError(err), "Unable to marshal to JSON.") console.Println(string(jBytes)) } diff --git a/cmd/cat-main.go b/cmd/cat-main.go index 10d49509..76f3bafb 100644 --- a/cmd/cat-main.go +++ b/cmd/cat-main.go @@ -243,7 +243,7 @@ func mainCat(ctx *cli.Context) error { } encKeyDB, err := parseAndValidateEncryptionKeys(sseKeys) - fatalIf(err, "Unable to parse encryption keys") + fatalIf(err, "Unable to parse encryption keys.") // Convert arguments to URLs: expand alias, fix format. for _, url := range args { fatalIf(catURL(url, encKeyDB).Trace(url), "Unable to read from `"+url+"`.") diff --git a/cmd/certs.go b/cmd/certs.go index d6f42eaf..db82bff0 100644 --- a/cmd/certs.go +++ b/cmd/certs.go @@ -137,7 +137,7 @@ func loadRootCAs() { for _, caFile := range caFiles { caCert, err := ioutil.ReadFile(caFile) if err != nil { - fatalIf(probe.NewError(err), "Unable to load a CA file") + fatalIf(probe.NewError(err), "Unable to load a CA file.") } globalRootCAs.AppendCertsFromPEM(caCert) } diff --git a/cmd/config-host-add.go b/cmd/config-host-add.go index 47359a3b..2908d5c1 100644 --- a/cmd/config-host-add.go +++ b/cmd/config-host-add.go @@ -96,7 +96,7 @@ func checkConfigHostAddSyntax(ctx *cli.Context) { api := ctx.String("api") bucketLookup := ctx.String("lookup") if !isValidAlias(alias) { - fatalIf(errInvalidAlias(alias), "Invalid alias") + fatalIf(errInvalidAlias(alias), "Invalid alias.") } if !isValidHostURL(url) { @@ -231,7 +231,7 @@ func mainConfigHostAdd(ctx *cli.Context) error { ) s3Config, err := buildS3Config(url, accessKey, secretKey, api, lookup) - fatalIf(err.Trace(ctx.Args()...), "Unable to initialize new config from the provided credentials") + fatalIf(err.Trace(ctx.Args()...), "Unable to initialize new config from the provided credentials.") addHost(ctx.Args().Get(0), hostConfigV9{ URL: s3Config.HostURL, diff --git a/cmd/config-host-list.go b/cmd/config-host-list.go index 2c2db1cf..317cc1a4 100644 --- a/cmd/config-host-list.go +++ b/cmd/config-host-list.go @@ -134,7 +134,7 @@ func listHosts(alias string) { }) return } - fatalIf(errInvalidAliasedURL(alias), "No such alias `"+alias+"` found") + fatalIf(errInvalidAliasedURL(alias), "No such alias `"+alias+"` found.") } var hosts []hostMessage diff --git a/cmd/cp-main.go b/cmd/cp-main.go index ad6ad8b5..afe2f495 100644 --- a/cmd/cp-main.go +++ b/cmd/cp-main.go @@ -222,7 +222,7 @@ func doPrepareCopyURLs(session *sessionV8, trapCh <-chan bool, cancelCopy contex newerThan := session.Header.CommandIntFlags["newer-than"] encryptKeys := session.Header.CommandStringFlags["encrypt-key"] encKeyDB, err := parseAndValidateEncryptionKeys(encryptKeys) - fatalIf(err, "Unable to parse encryption keys") + fatalIf(err, "Unable to parse encryption keys.") // Create a session data file to store the processed URLs. dataFP := session.NewDataWriter() diff --git a/cmd/events-remove.go b/cmd/events-remove.go index b56427a8..c9417f95 100644 --- a/cmd/events-remove.go +++ b/cmd/events-remove.go @@ -66,7 +66,7 @@ func checkEventsRemoveSyntax(ctx *cli.Context) { cli.ShowCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code } if len(ctx.Args()) == 1 && !ctx.Bool("force") { - fatalIf(probe.NewError(errors.New("")), "--force flag needs to be passed to remove all bucket notifications") + fatalIf(probe.NewError(errors.New("")), "--force flag needs to be passed to remove all bucket notifications.") } } diff --git a/cmd/find.go b/cmd/find.go index 58a04dfd..b9396a86 100644 --- a/cmd/find.go +++ b/cmd/find.go @@ -70,7 +70,7 @@ func (f findMessage) JSON() string { // func nameMatch(pattern, path string) bool { matched, e := filepath.Match(pattern, filepath.Base(path)) - errorIf(probe.NewError(e).Trace(pattern, path), "Unable to match with input pattern") + errorIf(probe.NewError(e).Trace(pattern, path), "Unable to match with input pattern.") if !matched { for _, pathComponent := range strings.Split(path, "/") { matched = pathComponent == pattern @@ -94,7 +94,7 @@ func pathMatch(pattern, path string) bool { // regexMatch reports whether path matches the regex pattern. func regexMatch(pattern, path string) bool { matched, e := regexp.MatchString(pattern, path) - errorIf(probe.NewError(e).Trace(pattern), "Unable to regex match with input pattern") + errorIf(probe.NewError(e).Trace(pattern), "Unable to regex match with input pattern.") return matched } @@ -141,7 +141,7 @@ func watchFind(ctx *findContext) { events: []string{"put"}, } watchObj, err := ctx.clnt.Watch(params) - fatalIf(err.Trace(ctx.targetAlias), "Cannot watch with given params") + fatalIf(err.Trace(ctx.targetAlias), "Cannot watch with given params.") // Enables users to kill using the control + c trapCh := signalTrap(os.Interrupt, syscall.SIGTERM) @@ -160,7 +160,7 @@ func watchFind(ctx *findContext) { time, e := time.Parse(time.RFC3339, event.Time) if e != nil { - errorIf(probe.NewError(e).Trace(event.Time), "Unable to parse event time") + errorIf(probe.NewError(e).Trace(event.Time), "Unable to parse event time.") continue } @@ -443,7 +443,7 @@ var defaultSevenDays = time.Duration(604800) * time.Second // argument to generate and return presigned URLs, returns error if any. func getShareURL(path string) string { targetAlias, targetURLFull, _, err := expandAlias(path) - fatalIf(err.Trace(path), "Unable to expand alias") + fatalIf(err.Trace(path), "Unable to expand alias.") clnt, err := newClientFromAlias(targetAlias, targetURLFull) fatalIf(err.Trace(targetAlias, targetURLFull), "Unable to initialize client instance from alias.") diff --git a/cmd/mirror-main.go b/cmd/mirror-main.go index efebdd8a..98d9e540 100644 --- a/cmd/mirror-main.go +++ b/cmd/mirror-main.go @@ -579,7 +579,7 @@ func (mj *mirrorJob) mirror(ctx context.Context, cancelMirror context.CancelFunc PathInsufficientPermission, ObjectOnGlacier: continue case deleteNotAllowedErr, overwriteNotAllowedErr: - errorIf(err, "Unable to perform a mirror action") + errorIf(err, "Unable to perform a mirror action.") continue } @@ -671,13 +671,13 @@ func runMirror(srcURL, dstURL string, ctx *cli.Context, encKeyDB map[string][]pr encKeyDB) srcClt, err := newClient(srcURL) - fatalIf(err, "Unable to initialize `"+srcURL+"`") + fatalIf(err, "Unable to initialize `"+srcURL+"`.") dstClt, err := newClient(dstURL) - fatalIf(err, "Unable to initialize `"+srcURL+"`") + fatalIf(err, "Unable to initialize `"+srcURL+"`.") if ctx.Bool("a") && (srcClt.GetURL().Type != objectStorage || dstClt.GetURL().Type != objectStorage) { - fatalIf(errDummy(), "Synchronizing bucket policies is only possible when both source & target point to S3 servers") + fatalIf(errDummy(), "Synchronizing bucket policies is only possible when both source & target point to S3 servers.") } mirrorAllBuckets := (srcClt.GetURL().Type == objectStorage && srcClt.GetURL().Path == "/") || @@ -704,13 +704,13 @@ func runMirror(srcURL, dstURL string, ctx *cli.Context, encKeyDB map[string][]pr if d.Diff == differInFirst { // Bucket only exists in the source, create the same bucket in the destination if err := newDstClt.MakeBucket(ctx.String("region"), false); err != nil { - errorIf(err, "Cannot created bucket in `"+newTgtURL+"`") + errorIf(err, "Cannot created bucket in `"+newTgtURL+"`.") continue } // Copy policy rules from source to dest if flag is activated if ctx.Bool("a") { if err := copyBucketPolicies(srcClt, dstClt, isOverwrite); err != nil { - errorIf(err, "Cannot copy bucket policies to `"+newDstClt.GetURL().String()+"`") + errorIf(err, "Cannot copy bucket policies to `"+newDstClt.GetURL().String()+"`.") } } } @@ -759,10 +759,10 @@ func mainMirror(ctx *cli.Context) error { } encKeyDB, err := parseAndValidateEncryptionKeys(sseKeys) - fatalIf(err, "Unable to parse encryption keys") + fatalIf(err, "Unable to parse encryption keys.") if err := runMirror(srcURL, tgtURL, ctx, encKeyDB); err != nil { - errorIf(err.Trace(srcURL, tgtURL), "Unable to mirror") + errorIf(err.Trace(srcURL, tgtURL), "Unable to mirror.") return exitStatus(globalErrorExitStatus) } diff --git a/cmd/pipe-main.go b/cmd/pipe-main.go index c3bcba4a..48be5f02 100644 --- a/cmd/pipe-main.go +++ b/cmd/pipe-main.go @@ -120,7 +120,7 @@ func mainPipe(ctx *cli.Context) error { } encKeyDB, err := parseAndValidateEncryptionKeys(sseKeys) - fatalIf(err, "Unable to parse encryption keys") + fatalIf(err, "Unable to parse encryption keys.") err = pipe(URLs[0], encKeyDB) fatalIf(err.Trace(URLs[0]), "Unable to write to one or more targets.") } diff --git a/cmd/policy-main.go b/cmd/policy-main.go index 88becdda..8aafedf1 100644 --- a/cmd/policy-main.go +++ b/cmd/policy-main.go @@ -327,7 +327,7 @@ func runPolicyLinksCmd(ctx *cli.Context) { // Encode public URL u, e := url.Parse(content.URL.String()) - errorIf(probe.NewError(e), "Unable to parse url `"+content.URL.String()+"`") + errorIf(probe.NewError(e), "Unable to parse url `"+content.URL.String()+"`.") publicURL := u.String() // Construct the message to be displayed to the user diff --git a/cmd/rm-main.go b/cmd/rm-main.go index ca0fc052..9de84b7d 100644 --- a/cmd/rm-main.go +++ b/cmd/rm-main.go @@ -337,7 +337,7 @@ func mainRm(ctx *cli.Context) error { } encKeyDB, perr := parseAndValidateEncryptionKeys(sseKeys) - fatalIf(perr, "Unable to parse encryption keys") + fatalIf(perr, "Unable to parse encryption keys.") // Set color. console.SetColor("Remove", color.New(color.FgGreen, color.Bold)) diff --git a/cmd/stat-main.go b/cmd/stat-main.go index 9badf6ac..e0265f1c 100644 --- a/cmd/stat-main.go +++ b/cmd/stat-main.go @@ -126,7 +126,7 @@ func mainStat(ctx *cli.Context) error { } encKeyDB, err := parseAndValidateEncryptionKeys(sseKeys) - fatalIf(err, "Unable to parse encryption keys") + fatalIf(err, "Unable to parse encryption keys.") var cErr error for _, targetURL := range args { diff --git a/cmd/update-main.go b/cmd/update-main.go index 43ab3fe7..ca4df0f3 100644 --- a/cmd/update-main.go +++ b/cmd/update-main.go @@ -134,7 +134,7 @@ func isDocker(cgroupFile string) (bool, *probe.Error) { // IsDocker - returns if the environment is docker or not. func IsDocker() bool { found, err := isDocker("/proc/self/cgroup") - fatalIf(err.Trace("/proc/self/cgroup"), "Unable to validate if this is a docker container") + fatalIf(err.Trace("/proc/self/cgroup"), "Unable to validate if this is a docker container.") return found } @@ -278,7 +278,7 @@ func mainUpdate(ctx *cli.Context) { console.SetColor("Update", color.New(color.FgGreen, color.Bold)) older, downloadURL, err := getUpdateInfo(10 * time.Second) - fatalIf(err.Trace(downloadURL), "Unable to fetch update info for mc") + fatalIf(err.Trace(downloadURL), "Unable to fetch update info for mc.") if !globalQuiet { printMsg(updateMessage{