Manipulating /etc/hosts file using Go
First pass on your code:


Don't panic. For example, your WriteHostsFile function should return error instead of bool.
Don't create a special struct for a string set. Just use map[string]bool and exploit zero values =) Don't be afraid to use map[string]map[string]bool to represent your hosts.


Your Add function go away, but fyi: you are making it return a bool and never using it.

Your pop function could be simplified and inlined. Just use ip, parts = parts[0], parts[1:].
Check for nil value using foo == nil instead of len(foo) == 0.
strings.Split(line, " ") only works if things are separated with spaces — but indentations are a perfectly valid separator for /etc/hosts =)
If your lines aren't too long (and you can probably assume lines from /etc/hosts are going to be smaller than 65k chars), use bufio.Scanner to read a file line by line. See this SO answer for a full example and a discussion of caveats.


Your GetLines function should probably be inlined, but fyi: you're silently discarding its argument.

You probably want to use flags for the input and output paths, and output on stdout by default (maybe have a flag to override /etc/hosts). Outputting to a file named hosts in the current directory is pretty unexpected.
Instead of for k := range hosts and then calling hosts[k], you can use directly for k, h := range hosts and use h.
You don't want to write into a file line by line — what if you're overwriting the original file and your binary fails in the middle? You probably want to have WriteHostsFile write into a bytes.Buffer and write everything at once at the end.
All your functions are exported (they start with an uppercase letter), but this is not a library; so you shouldn't export anything: they should all start with a lowercase letter.
Your algorithm is not deterministic, because you're iterating over the elements of a map in WriteHostsFile: it might be unexpected to see the file modified if all hosts are already correctly grouped. Sorting the hosts by key; or by first appearance in the original file, would solve this.


Cheers!