我正在嘗試運行在網(wǎng)上找到的示例Go程序,如下所示:/* IP */package mainimport ( "net" "os" "fmt")func main() { if len(os.Args) != 2 { fmt.Fprintf(os.Stderr, "Usage: %s ip-addr\n", os.Args[0]) os.Exit(1) } name := os.Args[1] addr := net.ParseIP(name) if addr == nil { fmt.Println("Invalid address") } else { fmt.Println("The address is ", addr.String()) } os.Exit(0)}然后,我嘗試使用以下命令進行編譯:6g ip.go我收到以下錯誤:ip.go:7: can't find import: net我的Go版本沒有網(wǎng)絡(luò)包裝嗎?還是我使用了錯誤的編譯器版本?謝謝!
- 1 回答
- 0 關(guān)注
- 343 瀏覽
添加回答
舉報
0/150
提交
取消