From 546a3f9c37f55d32946b9c9d3f03cdc13b12231d Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Wed, 4 Feb 2015 09:45:16 -0800 Subject: [PATCH] Replace make len 0 with var declarations --- hostess.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hostess.go b/hostess.go index 2c656c5..0f04530 100644 --- a/hostess.go +++ b/hostess.go @@ -57,7 +57,7 @@ func LooksLikeIpv6(ip string) bool { } func parseLine(line string) []Hostname { - hostnames := make([]Hostname, 0) + var hostnames []Hostname // Parse leading # for disabled lines enabled := true @@ -191,7 +191,7 @@ func MoveToFront(list []string, search string) []string { // ListDomainsByIp will look through Hostfile to find domains that match the // specified Ip and return them in a sorted slice. func (h *Hostfile) ListDomainsByIp(ip string) []string { - names := make([]string, 0) + var names []string for _, v := range h.Hosts { if v.Ip == ip { names = append(names, v.Domain) @@ -233,7 +233,7 @@ func (h *Hostfile) Format() string { localhosts_keys := getSortedMapKeys(localhosts) ips_keys := getSortedMapKeys(ips) - out := make([]string, 0) + var out []string for _, ip := range localhosts_keys { enabled := ip