Fixing typo: allocate slice with the correct size (#383)

This commit is contained in:
hchsiao 2022-08-17 00:00:42 +08:00 committed by GitHub
parent 872e9b06e1
commit c1dfc324fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -111,7 +111,7 @@ func (*bzlLibraryLang) Fix(c *config.Config, f *rule.File) {}
// returned, including an empty slice, the rule will be indexed. // returned, including an empty slice, the rule will be indexed.
func (b *bzlLibraryLang) Imports(c *config.Config, r *rule.Rule, f *rule.File) []resolve.ImportSpec { func (b *bzlLibraryLang) Imports(c *config.Config, r *rule.Rule, f *rule.File) []resolve.ImportSpec {
srcs := r.AttrStrings("srcs") srcs := r.AttrStrings("srcs")
imports := make([]resolve.ImportSpec, len(srcs)) imports := make([]resolve.ImportSpec, 0, len(srcs))
for _, src := range srcs { for _, src := range srcs {
spec := resolve.ImportSpec{ spec := resolve.ImportSpec{