diff --git a/main.go b/main.go index 425e5ec..ed766a3 100644 --- a/main.go +++ b/main.go @@ -106,25 +106,14 @@ func main() { } func addIfNotExists(entries []entry, e entry) []entry { - var ( - found bool - out []entry - ) - - for _, pe := range entries { + for i, pe := range entries { if pe.Domain == e.Domain { - found = true - pe.Comment = strings.Join([]string{pe.Comment, e.Comment}, ", ") + entries[i].Comment = strings.Join([]string{pe.Comment, e.Comment}, ", ") + return entries } - - out = append(out, pe) } - if !found { - out = append(out, e) - } - - return out + return append(entries, e) } func cleanFromList(blacklist, whitelist []entry) []entry { diff --git a/provider_hostFile.go b/provider_hostFile.go index 0403037..20761fa 100644 --- a/provider_hostFile.go +++ b/provider_hostFile.go @@ -54,7 +54,7 @@ func (p providerHostFile) GetDomainList(d providerDefinition) ([]entry, error) { continue } - comment := fmt.Sprintf("From: %q", d.Name) + comment := fmt.Sprintf("%q", d.Name) if len(groups) == 3 && strings.Trim(groups[2], "#") != "" { comment = fmt.Sprintf("%s, Comment: %q", comment,