Go中的“ net”包导入错误

I'm trying to run a sample Go program that I found on the net, which is given below:

/* IP */

package main

import (
    "net"
    "os"
    "fmt"
)

func main() {
    if len(os.Args) != 2 {
        fmt.Fprintf(os.Stderr, "Usage: %s ip-addr
", 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)
}

Then I try to compile it using:

6g ip.go

and I get the following error:

ip.go:7: can't find import: net

Does my go version not have a net package? or am I using a wrong version of compiler? Thanks!

If you are still using the 6g compiler command then I assume you are not using the recent Go1 stable release? It would depend on the version you are actually running. "net" is a valid package: http://golang.org/pkg/net/

Recommended that you install the latest Go.

$ go run ip.go 127.0.0.1
The address is  127.0.0.1

You can see that the go playground, using Go 1, works:
http://play.golang.org/p/rXSep9GH-U