I want to get the computer\'s IP address. I used the code below, but it returns 127.0.0.1.
I want to get the IP address, such as 10.32.10.111
net.LookupHost() on your os.Hostname() is probably always going to give you 127.0.0.1, because that's what's in your /etc/hosts or equivalent.
I think what you want to use is net.InterfaceAddrs():
func InterfaceAddrs() ([]Addr, error)InterfaceAddrs returns a list of the system's network interface addresses.