Skip to content

Commit 24ab496

Browse files
committed
refactor: use simplified empty-array literals
1 parent 47f9c7e commit 24ab496

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

language/js/node/package.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func ParsePackageJsonImports(packageJsonReader io.Reader) ([]string, error) {
3030
return nil, err
3131
}
3232

33-
imports := make([]string, 0)
33+
imports := []string{}
3434

3535
if c.Main != "" {
3636
imports = append(imports, path.Clean(c.Main))

language/js/proto/proto.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func GetProtoImports(filepath string) ([]string, error) {
5858
return nil, err
5959
}
6060

61-
imports := make([]string, 0)
61+
imports := []string{}
6262

6363
for _, match := range protoRe.FindAllSubmatch(content, -1) {
6464
switch {

language/kotlin/parser/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const importsQuery = `
5959
func (p *treeSitterParser) Parse(filePath string, sourceCode []byte) (*ParseResult, []error) {
6060
var result = &ParseResult{
6161
File: filePath,
62-
Imports: make([]string, 0),
62+
Imports: []string{},
6363
}
6464

6565
errs := make([]error, 0)

language/orion/host.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func (h *GazelleHost) ApparentLoads(moduleToApparentName func(string) string) []
263263
loads[fromStr] = &rule.LoadInfo{
264264
Name: fromStr,
265265
Symbols: make([]string, 0, 1),
266-
After: make([]string, 0),
266+
After: []string{},
267267
}
268268
}
269269

runner/pkg/git/gitignore_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func TestGitIgnore(t *testing.T) {
192192
// Util method to invoke GitIgnore.AddIgnore() with the trimmed string
193193
// value to allow tests to be written with multiline strings including indentation.
194194
func addIgnoreFileContent(parentPatterns []gitignore.Pattern, rel, ignoreContents string) (isGitIgnored, []gitignore.Pattern) {
195-
ignoreLines := make([]string, 0)
195+
ignoreLines := []string{}
196196
for line := range strings.SplitSeq(ignoreContents, "\n") {
197197
if trimmdLine := strings.TrimSpace(line); trimmdLine != "" {
198198
ignoreLines = append(ignoreLines, trimmdLine)

runner/pkg/watchman/watch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func (w *WatchmanWatcher) GetDiff(clockspec string) (*ChangeSet, error) {
207207
return nil, fmt.Errorf("query error response: %s", resp["error"])
208208
}
209209

210-
files := make([]string, 0)
210+
files := []string{}
211211

212212
if resp["files"] != nil {
213213
rf := resp["files"].([]interface{})
@@ -416,7 +416,7 @@ func (w *WatchmanWatcher) Subscribe(ctx context.Context, dropWithinState string)
416416
return
417417
}
418418

419-
files := make([]string, 0)
419+
files := []string{}
420420

421421
if resp["files"] != nil {
422422
rf := resp["files"].([]interface{})

0 commit comments

Comments
 (0)