chore: set default count module to 100

main
sudo pacman -Syu 2022-08-24 21:51:54 +07:00
parent 23e0300efc
commit de2929f796
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
1 changed files with 4 additions and 2 deletions

View File

@ -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)
}