1 package main 2 3 import ( 4 "fmt" 5 "net" 6 ) 7 8 func main() { 9 addrs, err := net.InterfaceAddrs() 10 if err != nil { 11 panic(err) 12 } 13 for _, addr := range addrs { 14 fmt.Println(addr.String()) 15 } 16 }