I'm using some code from Jan Newmarch's book on Go to run a daytime server on my mac. It uses this code
func main() {
service := ":1200"
tcpAddr, err := net.ResolveTCPAddr("ip4", service)
checkError(err)
listener, err := net.ListenTCP("tcp", tcpAddr)
checkError(err)
however, when I run it (on a Mac), I get this error
Fatal error: unknown network ip4
Is there anything other than ip4 that I can include in this code to avoid that error?
tcpAddr, err := net.ResolveTCPAddr("ip4", service)
Note, I also tried ip6
and got the same error.