goodhosts.go
func NewHostsLine(raw string) HostsLine {
	fields := strings.Fields(raw)
	if len(fields) == 0 {
		return HostsLine{Raw: raw}
	}

	output := HostsLine{Raw: raw}
	if !output.IsComment() {
		rawIP := fields[0]
		if net.ParseIP(rawIP) == nil {
			output.Err = errors.New(fmt.Sprintf("Bad hosts line: %q", raw))
		}

		output.IP = rawIP
		output.Hosts = fields[1:]
	}

	return output
}
func NewHostsLine(raw string) HostsLine {
	fields := strings.Fields(raw)
	if len(fields) == 0 {
		return HostsLine{Raw: raw}
	}

	output := HostsLine{Raw: raw}
	if !output.IsComment() {
		rawIP := fields[0]
		if net.ParseIP(rawIP) == nil {
			output.Err = errors.New(fmt.Sprintf("Bad hosts line: %q", raw))
		}

		output.IP = rawIP
		output.Hosts = fields[1:]
	}

	return output
}
func NewHostsLine ( raw string ) HostsLine { fields := strings . Fields ( raw ) if len ( fields ) == 0 { return HostsLine { Raw : raw } } output := HostsLine { Raw : raw } if ! output . IsComment ( ) { rawIP := fields [ 0 ] if net . ParseIP ( rawIP ) == nil { output . Err = errors . New ( fmt . Sprintf ( " " , raw ) ) } output . IP = rawIP output . Hosts = fields [ 1 : ] } return output }
// Return a new instance of ```HostsLine```.
Return a new instance of HostsLine .