Skip to content

Commit

Permalink
ast: add cap to array initialization when known (#5037)
Browse files Browse the repository at this point in the history
This adds the cap where it's known for capabilities and VarSet.

Signed-off-by: Emre Savcı <emre.savci@trendyol.com>
  • Loading branch information
mstrYoda committed Aug 23, 2022
1 parent eaea98c commit eb0fa70
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ast/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func LoadCapabilitiesVersions() ([]string, error) {
return nil, err
}

var capabilitiesVersions []string
capabilitiesVersions := make([]string, 0, len(ents))
for _, ent := range ents {
capabilitiesVersions = append(capabilitiesVersions, strings.Replace(ent.Name(), ".json", "", 1))
}
Expand Down
2 changes: 1 addition & 1 deletion ast/varset.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (s VarSet) Update(vs VarSet) {
}

func (s VarSet) String() string {
tmp := []string{}
tmp := make([]string, 0, len(s))
for v := range s {
tmp = append(tmp, string(v))
}
Expand Down

0 comments on commit eb0fa70

Please sign in to comment.