diff --git a/internal/cli/action_run.go b/internal/cli/action_run.go index 92b2d64..1774fa1 100644 --- a/internal/cli/action_run.go +++ b/internal/cli/action_run.go @@ -20,6 +20,8 @@ const ( vendorDirectory = "vendor" goModFile = "go.mod" goSumFile = "go.sum" + + defaultCountModule = 100 ) var ( @@ -58,7 +60,7 @@ func (a *action) Run(c *cli.Context) error { } // Read deps file line by line to upgrade - successUpgradedModules := make([]Module, 0, 100) + successUpgradedModules := make([]Module, 0, defaultCountModule) modulePaths := strings.Split(depsStr, "\n") for _, modulePath := range modulePaths { successUpgradedModules, err = a.runUpgradeModule(c, mapImportedModules, successUpgradedModules, modulePath) @@ -92,7 +94,7 @@ func (a *action) runGetImportedModules(c *cli.Context) (map[string]struct{}, err goOutputStr = strings.ReplaceAll(goOutputStr, "}{", "},{") goOutputStr = "[" + goOutputStr + "]" - importedModules := make([]Module, 0, 100) + importedModules := make([]Module, 0, defaultCountModule) if err := json.Unmarshal([]byte(goOutputStr), &importedModules); err != nil { return nil, fmt.Errorf("failed to json unmarshal: %w", err) }