Simple hosts file management in Go (golang).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

30 lines
517 B

package goodhosts
import (
"fmt"
"strings"
)
func itemInSlice(item string, list []string) bool {
for _, i := range list {
if i == item {
return true
}
}
return false
}
func buildRawLine(ip string, host string) string {
output := ip
output = fmt.Sprintf("%s %s", output, host)
return output
}
// IsComment Return ```true``` if the line is a comment.
func IsComment(line string) bool {
trimLine := strings.TrimSpace(line)
isComment := strings.HasPrefix(trimLine, commentChar)
return isComment
}