From 3b5354b2a5208d02041d5834b9419f067beeb4ce Mon Sep 17 00:00:00 2001 From: cellarspoon Date: Sat, 25 Dec 2021 02:03:09 +0100 Subject: [PATCH] refactor: less quotes --- cli/app/backup.go | 4 ++-- cli/app/check.go | 4 ++-- cli/app/config.go | 2 +- cli/app/remove.go | 2 +- cli/app/restore.go | 4 ++-- cli/app/rollback.go | 10 +++++----- cli/app/secret.go | 2 +- cli/app/undeploy.go | 4 ++-- cli/catalogue/catalogue.go | 2 +- cli/cli.go | 2 +- cli/recipe/version.go | 2 +- cli/record/list.go | 2 +- cli/record/remove.go | 2 +- cli/server/remove.go | 2 +- cli/upgrade.go | 2 +- pkg/app/app.go | 2 +- pkg/catalogue/catalogue.go | 4 ++-- pkg/client/client.go | 2 +- pkg/client/context.go | 2 +- pkg/client/registry.go | 2 +- pkg/compose/compose.go | 6 +++--- pkg/config/app.go | 6 +++--- pkg/dns/common.go | 2 +- pkg/recipe/recipe.go | 4 ++-- pkg/secret/pass.go | 8 ++++---- pkg/secret/secret.go | 18 +++++++++--------- 26 files changed, 51 insertions(+), 51 deletions(-) diff --git a/cli/app/backup.go b/cli/app/backup.go index 26d2a7f6..4208bcf2 100644 --- a/cli/app/backup.go +++ b/cli/app/backup.go @@ -41,7 +41,7 @@ var appBackupCommand = &cli.Command{ abraSh := path.Join(config.ABRA_DIR, "apps", app.Type, "abra.sh") if _, err := os.Stat(abraSh); err != nil { if os.IsNotExist(err) { - logrus.Fatalf("'%s' does not exist?", abraSh) + logrus.Fatalf("%s does not exist?", abraSh) } logrus.Fatal(err) } @@ -62,7 +62,7 @@ var appBackupCommand = &cli.Command{ logrus.Fatal(err) } if !strings.Contains(string(bytes), execCmd) { - logrus.Fatalf("%s doesn't have a '%s' function", app.Type, execCmd) + logrus.Fatalf("%s doesn't have a %s function", app.Type, execCmd) } sourceAndExec := fmt.Sprintf("%s; %s", sourceCmd, execCmd) diff --git a/cli/app/check.go b/cli/app/check.go index 1025d09b..78a6fcc0 100644 --- a/cli/app/check.go +++ b/cli/app/check.go @@ -23,7 +23,7 @@ var appCheckCommand = &cli.Command{ envSamplePath := path.Join(config.ABRA_DIR, "apps", app.Type, ".env.sample") if _, err := os.Stat(envSamplePath); err != nil { if os.IsNotExist(err) { - logrus.Fatalf("'%s' does not exist?", envSamplePath) + logrus.Fatalf("%s does not exist?", envSamplePath) } logrus.Fatal(err) } @@ -45,7 +45,7 @@ var appCheckCommand = &cli.Command{ logrus.Fatalf("%s is missing %s", app.Path, missingEnvVars) } - logrus.Infof("all necessary environment variables defined for '%s'", app.Name) + logrus.Infof("all necessary environment variables defined for %s", app.Name) return nil }, diff --git a/cli/app/config.go b/cli/app/config.go index 846bb4c5..6d182f67 100644 --- a/cli/app/config.go +++ b/cli/app/config.go @@ -31,7 +31,7 @@ var appConfigCommand = &cli.Command{ appFile, exists := files[appName] if !exists { - logrus.Fatalf("cannot find app with name '%s'", appName) + logrus.Fatalf("cannot find app with name %s", appName) } ed, ok := os.LookupEnv("EDITOR") diff --git a/cli/app/remove.go b/cli/app/remove.go index be6e7add..195109c4 100644 --- a/cli/app/remove.go +++ b/cli/app/remove.go @@ -60,7 +60,7 @@ var appRemoveCommand = &cli.Command{ logrus.Fatal(err) } if isDeployed { - logrus.Fatalf("'%s' is still deployed. Run \"abra app undeploy %s \" or pass --force", app.Name, app.Name) + logrus.Fatalf("%s is still deployed. Run \"abra app undeploy %s \" or pass --force", app.Name, app.Name) } } diff --git a/cli/app/restore.go b/cli/app/restore.go index d4fd7661..5d016c2f 100644 --- a/cli/app/restore.go +++ b/cli/app/restore.go @@ -40,7 +40,7 @@ var appRestoreCommand = &cli.Command{ abraSh := path.Join(config.ABRA_DIR, "apps", app.Type, "abra.sh") if _, err := os.Stat(abraSh); err != nil { if os.IsNotExist(err) { - logrus.Fatalf("'%s' does not exist?", abraSh) + logrus.Fatalf("%s does not exist?", abraSh) } logrus.Fatal(err) } @@ -60,7 +60,7 @@ var appRestoreCommand = &cli.Command{ logrus.Fatal(err) } if !strings.Contains(string(bytes), execCmd) { - logrus.Fatalf("%s doesn't have a '%s' function", app.Type, execCmd) + logrus.Fatalf("%s doesn't have a %s function", app.Type, execCmd) } backupFile := c.Args().Get(2) diff --git a/cli/app/rollback.go b/cli/app/rollback.go index 68330023..690f82c2 100644 --- a/cli/app/rollback.go +++ b/cli/app/rollback.go @@ -50,7 +50,7 @@ recipes. logrus.Fatal(err) } - logrus.Debugf("checking whether '%s' is already deployed", stackName) + logrus.Debugf("checking whether %s is already deployed", stackName) isDeployed, deployedVersion, err := stack.IsDeployed(c.Context, cl, stackName) if err != nil { @@ -58,7 +58,7 @@ recipes. } if !isDeployed { - logrus.Fatalf("'%s' is not deployed?", app.Name) + logrus.Fatalf("%s is not deployed?", app.Name) } catl, err := catalogue.ReadRecipeCatalogue() @@ -75,7 +75,7 @@ recipes. if deployedVersion == "" { deployedVersion = "unknown" availableDowngrades = versions - logrus.Warnf("failed to determine version of deployed '%s'", app.Name) + logrus.Warnf("failed to determine version of deployed %s", app.Name) } if deployedVersion != "unknown" && !internal.Chaos { @@ -108,10 +108,10 @@ recipes. if !internal.Chaos { if internal.Force { chosenDowngrade = availableDowngrades[0] - logrus.Debugf("choosing '%s' as version to downgrade to (--force)", chosenDowngrade) + logrus.Debugf("choosing %s as version to downgrade to (--force)", chosenDowngrade) } else { prompt := &survey.Select{ - Message: fmt.Sprintf("Please select a downgrade (current version: '%s'):", deployedVersion), + Message: fmt.Sprintf("Please select a downgrade (current version: %s):", deployedVersion), Options: availableDowngrades, } if err := survey.AskOne(prompt, &chosenDowngrade); err != nil { diff --git a/cli/app/secret.go b/cli/app/secret.go index 5bafcc51..8797d360 100644 --- a/cli/app/secret.go +++ b/cli/app/secret.go @@ -60,7 +60,7 @@ var appSecretGenerateCommand = &cli.Command{ } } if !matches { - logrus.Fatalf("'%s' doesn't exist in the env config?", secretName) + logrus.Fatalf("%s doesn't exist in the env config?", secretName) } } diff --git a/cli/app/undeploy.go b/cli/app/undeploy.go index 4bdd2825..58709807 100644 --- a/cli/app/undeploy.go +++ b/cli/app/undeploy.go @@ -27,7 +27,7 @@ volumes as eligiblef or pruning once undeployed. logrus.Fatal(err) } - logrus.Debugf("checking whether '%s' is already deployed", stackName) + logrus.Debugf("checking whether %s is already deployed", stackName) isDeployed, deployedVersion, err := stack.IsDeployed(c.Context, cl, stackName) if err != nil { @@ -35,7 +35,7 @@ volumes as eligiblef or pruning once undeployed. } if !isDeployed { - logrus.Fatalf("'%s' is not deployed?", stackName) + logrus.Fatalf("%s is not deployed?", stackName) } if err := internal.DeployOverview(app, deployedVersion, "continue with undeploy?"); err != nil { diff --git a/cli/catalogue/catalogue.go b/cli/catalogue/catalogue.go index f67b24f5..2ded57b7 100644 --- a/cli/catalogue/catalogue.go +++ b/cli/catalogue/catalogue.go @@ -142,7 +142,7 @@ A new catalogue copy can be published to the recipes repository by passing the } if !isClean { - logrus.Fatalf("'%s' has locally unstaged changes", rm.Name) + logrus.Fatalf("%s has locally unstaged changes", rm.Name) } if err := gitPkg.EnsureUpToDate(recipeDir); err != nil { diff --git a/cli/cli.go b/cli/cli.go index c7581d1c..9423bd2b 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -85,7 +85,7 @@ convenient command-line experience. See "abra autocomplete -h" for more. } } - logrus.Debugf("abra version '%s', commit '%s'", version, commit) + logrus.Debugf("abra version %s, commit %s", version, commit) return nil } diff --git a/cli/recipe/version.go b/cli/recipe/version.go index 9e71749f..bfb8fc0c 100644 --- a/cli/recipe/version.go +++ b/cli/recipe/version.go @@ -23,7 +23,7 @@ var recipeVersionCommand = &cli.Command{ recipeMeta, ok := catalogue[recipe.Name] if !ok { - logrus.Fatalf("'%s' recipe doesn't exist?", recipe.Name) + logrus.Fatalf("%s recipe doesn't exist?", recipe.Name) } tableCol := []string{"Version", "Service", "Image", "Tag", "Digest"} diff --git a/cli/record/list.go b/cli/record/list.go index 1baa6114..84e08bdf 100644 --- a/cli/record/list.go +++ b/cli/record/list.go @@ -46,7 +46,7 @@ are listed. This zone must already be created on your provider account. logrus.Fatal(err) } default: - logrus.Fatalf("'%s' is not a supported DNS provider", internal.DNSProvider) + logrus.Fatalf("%s is not a supported DNS provider", internal.DNSProvider) } records, err := provider.GetRecords(c.Context, zone) diff --git a/cli/record/remove.go b/cli/record/remove.go index 2fd908f3..d9d35218 100644 --- a/cli/record/remove.go +++ b/cli/record/remove.go @@ -59,7 +59,7 @@ You may also invoke this command in "wizard" mode and be prompted for input logrus.Fatal(err) } default: - logrus.Fatalf("'%s' is not a supported DNS provider", internal.DNSProvider) + logrus.Fatalf("%s is not a supported DNS provider", internal.DNSProvider) } if err := internal.EnsureDNSTypeFlag(c); err != nil { diff --git a/cli/server/remove.go b/cli/server/remove.go index fb4c9751..c046e482 100644 --- a/cli/server/remove.go +++ b/cli/server/remove.go @@ -168,7 +168,7 @@ like tears in rain. logrus.Fatal(err) } - logrus.Infof("server at '%s' has been lost in time, like tears in rain", serverName) + logrus.Infof("server at %s has been lost in time, like tears in rain", serverName) return nil }, diff --git a/cli/upgrade.go b/cli/upgrade.go index 86f95a79..94781704 100644 --- a/cli/upgrade.go +++ b/cli/upgrade.go @@ -33,7 +33,7 @@ testing efforts! cmd = exec.Command("bash", "-c", fmt.Sprintf("curl -s %s | bash -s -- --rc", releaseCandidateURL)) } - logrus.Debugf("attempting to run '%s'", cmd) + logrus.Debugf("attempting to run %s", cmd) if err := internal.RunCmd(cmd); err != nil { logrus.Fatal(err) diff --git a/pkg/app/app.go b/pkg/app/app.go index 1ec088b5..41593b0b 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -23,7 +23,7 @@ func Get(appName string) (config.App, error) { return config.App{}, err } - logrus.Debugf("retrieved '%s' for '%s'", app, appName) + logrus.Debugf("retrieved %s for %s", app, appName) return app, nil } diff --git a/pkg/catalogue/catalogue.go b/pkg/catalogue/catalogue.go index ec46c5fd..9dd3d348 100644 --- a/pkg/catalogue/catalogue.go +++ b/pkg/catalogue/catalogue.go @@ -384,12 +384,12 @@ func GetStringInBetween(str, start, end string) (result string, err error) { // GetStringInBetween returns empty string if no start or end string found s := strings.Index(str, start) if s == -1 { - return "", fmt.Errorf("marker string '%s' not found", start) + return "", fmt.Errorf("marker string %s not found", start) } s += len(start) e := strings.Index(str[s:], end) if e == -1 { - return "", fmt.Errorf("end marker '%s' not found", end) + return "", fmt.Errorf("end marker %s not found", end) } return str[s : s+e], nil } diff --git a/pkg/client/client.go b/pkg/client/client.go index 08672f9f..59eb178b 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -55,7 +55,7 @@ func New(contextName string) (*client.Client, error) { return nil, err } - logrus.Debugf("created client for '%s'", contextName) + logrus.Debugf("created client for %s", contextName) return cl, nil } diff --git a/pkg/client/context.go b/pkg/client/context.go index a9eac62c..11ba8c0e 100644 --- a/pkg/client/context.go +++ b/pkg/client/context.go @@ -26,7 +26,7 @@ func CreateContext(contextName string, user string, port string) error { if err := createContext(contextName, host); err != nil { return err } - logrus.Debugf("created the '%s' context", contextName) + logrus.Debugf("created the %s context", contextName) return nil } diff --git a/pkg/client/registry.go b/pkg/client/registry.go index 639d5d07..2764035f 100644 --- a/pkg/client/registry.go +++ b/pkg/client/registry.go @@ -182,7 +182,7 @@ func GetTagDigest(cl *client.Client, image reference.Named) (string, error) { } if digest == "" { - return "", fmt.Errorf("Unable to retrieve amd64 digest for '%s'", image) + return "", fmt.Errorf("Unable to retrieve amd64 digest for %s", image) } return digest, nil diff --git a/pkg/compose/compose.go b/pkg/compose/compose.go index fb82c36f..d1c32b65 100644 --- a/pkg/compose/compose.go +++ b/pkg/compose/compose.go @@ -22,7 +22,7 @@ func UpdateTag(pattern, image, tag, recipeName string) error { return err } - logrus.Debugf("considering '%s' config(s) for tag update", strings.Join(composeFiles, ", ")) + logrus.Debugf("considering %s config(s) for tag update", strings.Join(composeFiles, ", ")) for _, composeFile := range composeFiles { opts := stack.Deploy{Composefiles: []string{composeFile}} @@ -57,7 +57,7 @@ func UpdateTag(pattern, image, tag, recipeName string) error { } composeTag := img.(reference.NamedTagged).Tag() - logrus.Debugf("parsed '%s' from '%s'", composeTag, service.Image) + logrus.Debugf("parsed %s from %s", composeTag, service.Image) if image == composeImage { bytes, err := ioutil.ReadFile(composeFile) @@ -69,7 +69,7 @@ func UpdateTag(pattern, image, tag, recipeName string) error { new := fmt.Sprintf("%s:%s", composeImage, tag) replacedBytes := strings.Replace(string(bytes), old, new, -1) - logrus.Debugf("updating '%s' to '%s' in '%s'", old, new, compose.Filename) + logrus.Debugf("updating %s to %s in %s", old, new, compose.Filename) if err := ioutil.WriteFile(compose.Filename, []byte(replacedBytes), 0764); err != nil { return err diff --git a/pkg/config/app.go b/pkg/config/app.go index 1fdf9e29..88b8531f 100644 --- a/pkg/config/app.go +++ b/pkg/config/app.go @@ -96,14 +96,14 @@ func (a ByName) Less(i, j int) bool { func readAppEnvFile(appFile AppFile, name AppName) (App, error) { env, err := ReadEnv(appFile.Path) if err != nil { - return App{}, fmt.Errorf("env file for '%s' couldn't be read: %s", name, err.Error()) + return App{}, fmt.Errorf("env file for %s couldn't be read: %s", name, err.Error()) } - logrus.Debugf("read env '%s' from '%s'", env, appFile.Path) + logrus.Debugf("read env %s from %s", env, appFile.Path) app, err := newApp(env, name, appFile) if err != nil { - return App{}, fmt.Errorf("env file for '%s' has issues: %s", name, err.Error()) + return App{}, fmt.Errorf("env file for %s has issues: %s", name, err.Error()) } return app, nil diff --git a/pkg/dns/common.go b/pkg/dns/common.go index 1a31dc35..d10f2bdb 100644 --- a/pkg/dns/common.go +++ b/pkg/dns/common.go @@ -47,7 +47,7 @@ func EnsureIPv4(domainName string) (string, error) { }, } - logrus.Debugf("created DNS resolver via '%s'", freifunkDNS) + logrus.Debugf("created DNS resolver via %s", freifunkDNS) ctx := context.Background() ips, err := resolver.LookupIPAddr(ctx, domainName) diff --git a/pkg/recipe/recipe.go b/pkg/recipe/recipe.go index 257931b8..e96b98bd 100644 --- a/pkg/recipe/recipe.go +++ b/pkg/recipe/recipe.go @@ -64,7 +64,7 @@ func (r Recipe) Tags() ([]string, error) { return tags, err } - logrus.Debugf("detected '%s' as tags for recipe '%s'", strings.Join(tags, ", "), r.Name) + logrus.Debugf("detected %s as tags for recipe %s", strings.Join(tags, ", "), r.Name) return tags, nil } @@ -129,7 +129,7 @@ func EnsureVersion(recipeName, version string) error { } if !isClean { - return fmt.Errorf("'%s' has locally unstaged changes", recipeName) + return fmt.Errorf("%s has locally unstaged changes", recipeName) } if err := gitPkg.EnsureGitRepo(recipeDir); err != nil { diff --git a/pkg/secret/pass.go b/pkg/secret/pass.go index 5025dde7..7015936c 100644 --- a/pkg/secret/pass.go +++ b/pkg/secret/pass.go @@ -19,13 +19,13 @@ func PassInsertSecret(secretValue, secretName, appName, server string) error { secretValue, server, appName, secretName, ) - logrus.Debugf("attempting to run '%s'", cmd) + logrus.Debugf("attempting to run %s", cmd) if err := exec.Command("bash", "-c", cmd).Run(); err != nil { return err } - logrus.Infof("'%s' inserted into pass store", secretName) + logrus.Infof("%s inserted into pass store", secretName) return nil } @@ -41,13 +41,13 @@ func PassRmSecret(secretName, appName, server string) error { server, appName, secretName, ) - logrus.Debugf("attempting to run '%s'", cmd) + logrus.Debugf("attempting to run %s", cmd) if err := exec.Command("bash", "-c", cmd).Run(); err != nil { return err } - logrus.Infof("'%s' removed from pass store", secretName) + logrus.Infof("%s removed from pass store", secretName) return nil } diff --git a/pkg/secret/secret.go b/pkg/secret/secret.go index 2175fe2f..59a9be79 100644 --- a/pkg/secret/secret.go +++ b/pkg/secret/secret.go @@ -34,7 +34,7 @@ func GeneratePasswords(count, length uint) ([]string, error) { return nil, err } - logrus.Debugf("generated '%s'", strings.Join(passwords, ", ")) + logrus.Debugf("generated %s", strings.Join(passwords, ", ")) return passwords, nil } @@ -53,7 +53,7 @@ func GeneratePassphrases(count uint) ([]string, error) { return nil, err } - logrus.Debugf("generated '%s'", strings.Join(passphrases, ", ")) + logrus.Debugf("generated %s", strings.Join(passphrases, ", ")) return passphrases, nil } @@ -69,7 +69,7 @@ func ReadSecretEnvVars(appEnv config.AppEnv) map[string]string { } } - logrus.Debugf("read '%s' as secrets from '%s'", secretEnvVars, appEnv) + logrus.Debugf("read %s as secrets from %s", secretEnvVars, appEnv) return secretEnvVars } @@ -79,7 +79,7 @@ func ParseSecretEnvVarName(secretEnvVar string) string { withoutPrefix := strings.TrimPrefix(secretEnvVar, "SECRET_") withoutSuffix := strings.TrimSuffix(withoutPrefix, "_VERSION") name := strings.ToLower(withoutSuffix) - logrus.Debugf("parsed '%s' as name from '%s'", name, secretEnvVar) + logrus.Debugf("parsed %s as name from %s", name, secretEnvVar) return name } @@ -89,7 +89,7 @@ func ParseGeneratedSecretName(secret string, appEnv config.App) string { withoutAppName := strings.TrimPrefix(secret, name) idx := strings.LastIndex(withoutAppName, "_") parsed := withoutAppName[:idx] - logrus.Debugf("parsed '%s' as name from '%s'", parsed, secret) + logrus.Debugf("parsed %s as name from %s", parsed, secret) return parsed } @@ -97,7 +97,7 @@ func ParseGeneratedSecretName(secret string, appEnv config.App) string { func ParseSecretEnvVarValue(secret string) (secretValue, error) { values := strings.Split(secret, "#") if len(values) == 0 { - return secretValue{}, fmt.Errorf("unable to parse '%s'", secret) + return secretValue{}, fmt.Errorf("unable to parse %s", secret) } if len(values) == 1 { @@ -113,7 +113,7 @@ func ParseSecretEnvVarValue(secret string) (secretValue, error) { } version := strings.ReplaceAll(values[0], " ", "") - logrus.Debugf("parsed version '%s' and length '%v' from '%s'", version, length, secret) + logrus.Debugf("parsed version %s and length '%v' from %s", version, length, secret) return secretValue{Version: version, Length: length}, nil } @@ -132,7 +132,7 @@ func GenerateSecrets(secretEnvVars map[string]string, appName, server string) (m return } secretRemoteName := fmt.Sprintf("%s_%s_%s", appName, secretName, secretValue.Version) - logrus.Debugf("attempting to generate and store '%s' on '%s'", secretRemoteName, server) + logrus.Debugf("attempting to generate and store %s on %s", secretRemoteName, server) if secretValue.Length > 0 { passwords, err := GeneratePasswords(1, uint(secretValue.Length)) if err != nil { @@ -177,7 +177,7 @@ func GenerateSecrets(secretEnvVars map[string]string, appName, server string) (m } } - logrus.Debugf("generated and stored '%s' on '%s'", secrets, server) + logrus.Debugf("generated and stored %s on %s", secrets, server) return secrets, nil }