Created
June 12, 2014 04:10
-
-
Save nick-fedesna/47e3e6d6176b13a55ce6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net" | |
"os" | |
) | |
func main() { | |
name, err := os.Hostname() | |
if err != nil { | |
fmt.Printf("Oops: %v\n", err) | |
return | |
} | |
addrs, err := net.LookupHost(name) | |
if err != nil { | |
fmt.Printf("Oops: %v\n", err) | |
return | |
} | |
for _, a := range addrs { | |
fmt.Println(a) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment