goodhosts.go
func (h Hosts) Flush() error {
	file, err := os.Create(h.Path)
	if err != nil {
		return err
	}

	w := bufio.NewWriter(file)

	for _, line := range h.Lines {
		fmt.Fprintf(w, "%s%s", line.Raw, eol)
	}

	err = w.Flush()
	if err != nil {
		return err
	}

	return h.Load()
}
func (h Hosts) Flush() error {
	file, err := os.Create(h.Path)
	if err != nil {
		return err
	}

	w := bufio.NewWriter(file)

	for _, line := range h.Lines {
		fmt.Fprintf(w, "%s%s", line.Raw, eol)
	}

	err = w.Flush()
	if err != nil {
		return err
	}

	return h.Load()
}
func ( h Hosts ) Flush ( ) error { file , err := os . Create ( h . Path ) if err != nil { return err } w := bufio . NewWriter ( file ) for _ , line := range h . Lines { fmt . Fprintf ( w , " " , line . Raw , eol ) } err = w . Flush ( ) if err != nil { return err } return h . Load ( ) }
// Flush any changes made to hosts file.
Flush any changes made to hosts file .