-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Description
Before filing a bug, please check whether it has been fixed since the latest release: run "hg pull -u" and retry what you did to reproduce the problem. Thanks. What steps will reproduce the problem? package main import "net" import "log" func main() { for i := 1;; i++ { iface, err := net.InterfaceByIndex(i) if err != nil { log.Printf("iface: %s\n", err) break } log.Printf("Interface %q\n", iface.Name) if !iface.IsUp() { log.Printf(" - Down\n") continue } log.Printf(" - MAC : %s\n", iface.HardwareAddr) addrs, err := iface.Addrs() if err != nil { log.Printf("iface: %s\n", err) continue } for _, addr := range addrs { log.Printf(" - Addr: %s\n", addr) } } } What is the expected output? 2011/06/10 08:46:43 Interface "lo" //<-- 2011/06/10 08:46:43 - MAC : 2011/06/10 08:46:43 - Addr: 127.0.0.1 2011/06/10 08:46:43 - Addr: ::1 2011/06/10 08:46:43 Interface "eth0" 2011/06/10 08:46:43 - MAC : <REDACTED> 2011/06/10 08:46:43 - Addr: <REDACTED> What do you see instead? 2011/06/10 08:46:43 Interface "lo\x00" //<-- 2011/06/10 08:46:43 - MAC : 2011/06/10 08:46:43 - Addr: 127.0.0.1 2011/06/10 08:46:43 - Addr: ::1 2011/06/10 08:46:43 Interface "eth0\x00" 2011/06/10 08:46:43 - MAC : <REDACTED> 2011/06/10 08:46:43 - Addr: <REDACTED> Which compiler are you using (5g, 6g, 8g, gccgo)? 6g version weekly.2011-06-09 8707+ Which operating system are you using? Linux x86_64 Which revision are you using? (hg identify) 8818ac606e92+ tip Please provide any additional information below. I suspect this line needs a "[:len(...)-1]": http://localhost:8080/src/pkg/net/interface_linux.go#L115