Skip to content

Commit

Permalink
Merge pull request #338 from tofuutils/fix/spelling
Browse files Browse the repository at this point in the history
fix: spelling
  • Loading branch information
kvendingoldo authored Jan 22, 2025
2 parents 234c00e + 346b316 commit d6e128a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions versionmanager/semantic/parser/iac/iacparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func GatherRequiredVersion(conf *config.Config, exts []ExtDescription) ([]string
}
}

var requireds []string
var requiredVersions []string
var parsedFile *hcl.File
var diags hcl.Diagnostics
foundFiles = make([]string, 0, len(similar))
Expand All @@ -106,10 +106,10 @@ func GatherRequiredVersion(conf *config.Config, exts []ExtDescription) ([]string
}

extracted := extractRequiredVersion(parsedFile.Body, conf)
requireds = append(requireds, extracted...)
requiredVersions = append(requiredVersions, extracted...)
}

return requireds, nil
return requiredVersions, nil
}

func extractRequiredVersion(body hcl.Body, conf *config.Config) []string {
Expand All @@ -120,7 +120,7 @@ func extractRequiredVersion(body hcl.Body, conf *config.Config) []string {
return nil
}

requireds := make([]string, 0, 1)
requiredVersions := make([]string, 0, 1)
for _, block := range rootContent.Blocks {
content, _, diags := block.Body.PartialContent(versionPartialSchema)
if diags.HasErrors() {
Expand Down Expand Up @@ -159,10 +159,10 @@ func extractRequiredVersion(body hcl.Body, conf *config.Config) []string {

continue
}
requireds = append(requireds, val.AsString())
requiredVersions = append(requiredVersions, val.AsString())
}

return requireds
return requiredVersions
}

func filterExts(fileExts int, exts []ExtDescription) ExtDescription {
Expand Down
12 changes: 6 additions & 6 deletions versionmanager/semantic/semantic.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ func StableVersion(versionStr string) bool {
return err == nil && v.Prerelease() == ""
}

func addDefaultConstraint(constraintInfo types.ConstraintInfo, conf *config.Config, requireds ...string) (version.Constraints, error) {
func addDefaultConstraint(constraintInfo types.ConstraintInfo, conf *config.Config, requiredVersions ...string) (version.Constraints, error) {
if defaultConstraint := constraintInfo.ReadDefaultConstraint(); defaultConstraint != "" {
requireds = append(requireds, defaultConstraint)
requiredVersions = append(requiredVersions, defaultConstraint)
}
conf.Displayer.Log(hclog.Debug, "Find", "constraints", requireds)
conf.Displayer.Log(hclog.Debug, "Find", "constraints", requiredVersions)

var constraint version.Constraints
for _, required := range requireds {
for _, required := range requiredVersions {
temp, err := version.NewConstraint(required)
if err != nil {
return nil, err
Expand All @@ -142,10 +142,10 @@ func predicateFromConstraint(constraint version.Constraints) func(string) bool {
}

func readIACfiles(constraintInfo types.ConstraintInfo, iacExts []iacparser.ExtDescription, conf *config.Config) (version.Constraints, error) {
requireds, err := iacparser.GatherRequiredVersion(conf, iacExts)
requiredVersions, err := iacparser.GatherRequiredVersion(conf, iacExts)
if err != nil {
return nil, err
}

return addDefaultConstraint(constraintInfo, conf, requireds...)
return addDefaultConstraint(constraintInfo, conf, requiredVersions...)
}

0 comments on commit d6e128a

Please sign in to comment.