diff --git a/pkg/hosts/hosts.go b/pkg/hosts/hosts.go index c0f2cd8e..16a2b823 100644 --- a/pkg/hosts/hosts.go +++ b/pkg/hosts/hosts.go @@ -3,6 +3,7 @@ package hosts import ( "fmt" "regexp" + "runtime" "sort" "strings" @@ -66,6 +67,11 @@ func (h *Hosts) Add(ip string, hosts []string) error { if err := h.File.Add(ip, hostEntries...); err != nil { return err } + // Only execute clean in case of windows to avoid more than + // 9 domain entry in a single line + if runtime.GOOS == "windows" { + h.File.Clean() + } return h.File.Flush() }