diff --git a/discovery/file/file.go b/discovery/file/file.go index 41c2e0d234..afe1efdb76 100644 --- a/discovery/file/file.go +++ b/discovery/file/file.go @@ -24,7 +24,7 @@ func (s *FileDiscoveryService) Initialize(path string, heartbeat int) error { } func parseFileContent(content []byte) []string { - result := make([]string, 0) + var result []string for _, line := range strings.Split(strings.TrimSpace(string(content)), "\n") { for _, ip := range discovery.Generate(line) { result = append(result, ip) diff --git a/discovery/generator.go b/discovery/generator.go index d95c5ce3d8..81c19f6b33 100644 --- a/discovery/generator.go +++ b/discovery/generator.go @@ -27,7 +27,7 @@ func Generate(pattern string) []string { template := re.ReplaceAllString(pattern, "%d") - result := make([]string, 0) + var result []string for val := from; val <= to; val++ { entry := fmt.Sprintf(template, val) result = append(result, entry)