From cc44fbc78c1fbba24acf5a8d01c1a2c81b96e6f8 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Wed, 24 Aug 2022 22:38:51 +0700 Subject: [PATCH] chore: new line after a.log --- internal/cli/action.go | 2 +- internal/cli/action_run.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/cli/action.go b/internal/cli/action.go index d2c472d..65ff8f5 100644 --- a/internal/cli/action.go +++ b/internal/cli/action.go @@ -35,7 +35,7 @@ func (a *action) getFlags(c *cli.Context) { a.flags.depsURL = c.String(flagDepsURLName) a.flags.dryRun = c.Bool(flagDryRun) - a.log("Flags %+v", a.flags) + a.log("Flags %+v\n", a.flags) } func (a *action) log(format string, v ...interface{}) { diff --git a/internal/cli/action_run.go b/internal/cli/action_run.go index 7c299fa..7edf1c4 100644 --- a/internal/cli/action_run.go +++ b/internal/cli/action_run.go @@ -106,7 +106,7 @@ func (a *action) runGetImportedModules(c *cli.Context) (map[string]Module, error if err := json.Unmarshal([]byte(goOutputStr), &importedModules); err != nil { return nil, fmt.Errorf("failed to json unmarshal: %w", err) } - a.log("Go output: %s", string(goOutput)) + a.log("Go output: %s\n", string(goOutput)) mapImportedModules := make(map[string]Module) for _, importedModule := range importedModules { @@ -180,11 +180,11 @@ func (a *action) runUpgradeModule( return successUpgradedModules, nil } - a.log("Module path: %s", modulePath) + a.log("Module path: %s\n", modulePath) // Ignore not imported module if _, ok := mapImportedModules[modulePath]; !ok { - a.log("%s is not imported module", modulePath) + a.log("%s is not imported module\n", modulePath) return successUpgradedModules, nil } @@ -194,13 +194,13 @@ func (a *action) runUpgradeModule( if err != nil { return successUpgradedModules, fmt.Errorf("failed to run go %+v: %w", strings.Join(goListArgs, " "), err) } - a.log("Go output: %s", string(goOutput)) + a.log("Go output: %s\n", string(goOutput)) module := Module{} if err := json.Unmarshal(goOutput, &module); err != nil { return successUpgradedModules, fmt.Errorf("failed to json unmarshal: %w", err) } - a.log("Module: %+v", module) + a.log("Module: %+v\n", module) if module.Update == nil { color.PrintAppOK(name, fmt.Sprintf("You already have latest [%s] version [%s]", module.Path, module.Version)) @@ -220,7 +220,7 @@ func (a *action) runUpgradeModule( if err != nil { return successUpgradedModules, fmt.Errorf("failed to run go %+v: %w", strings.Join(goGetArgs, " "), err) } - a.log("Go output: %s", string(goOutput)) + a.log("Go output: %s\n", string(goOutput)) successUpgradedModules = append(successUpgradedModules, module) @@ -240,7 +240,7 @@ func (a *action) runGoMod(c *cli.Context, existVendor bool) error { if err != nil { return fmt.Errorf("failed to run go %+v: %w", strings.Join(goModArgs, " "), err) } - a.log("Go output: %s", string(goOutput)) + a.log("Go output: %s\n", string(goOutput)) if existVendor { // go mod vendor @@ -249,7 +249,7 @@ func (a *action) runGoMod(c *cli.Context, existVendor bool) error { if err != nil { return fmt.Errorf("failed to run go %+v: %w", strings.Join(goModArgs, " "), err) } - a.log("Go output: %s", string(goOutput)) + a.log("Go output: %s\n", string(goOutput)) } return nil @@ -283,7 +283,7 @@ func (a *action) runGitCommit(c *cli.Context, successUpgradedModules []Module, e if err != nil { return fmt.Errorf("failed to run git %+v: %w", strings.Join(gitAddArgs, " "), err) } - a.log("Git output: %s", string(gitOutput)) + a.log("Git output: %s\n", string(gitOutput)) // git commit gitCommitMessage := "build: upgrade modules\n" @@ -295,7 +295,7 @@ func (a *action) runGitCommit(c *cli.Context, successUpgradedModules []Module, e if err != nil { return fmt.Errorf("failed to run git %+v: %w", strings.Join(gitCommitArgs, " "), err) } - a.log("Git output: %s", string(gitOutput)) + a.log("Git output: %s\n", string(gitOutput)) return nil }