diff options
| author | Andrew Gerrand <adg@golang.org> | 2011-07-26 04:16:34 +1000 |
|---|---|---|
| committer | Andrew Gerrand <adg@golang.org> | 2011-07-26 04:16:34 +1000 |
| commit | 83305fecfeaf7d8f759d1b95f8f98dda2580df0b (patch) | |
| tree | 45df7a68eac4b7fd69957bb44dade2689321a03e /src/cmd/goinstall | |
| parent | 75c918c1ae5fdecc5da3d2d214baf0e547d43bfa (diff) | |
| download | go-83305fecfeaf7d8f759d1b95f8f98dda2580df0b.tar.xz | |
goinstall: abort and warn when using any url scheme, not just 'http://'
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4801053
Diffstat (limited to 'src/cmd/goinstall')
| -rw-r--r-- | src/cmd/goinstall/main.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cmd/goinstall/main.go b/src/cmd/goinstall/main.go index 7c04208e8c..86e490e24a 100644 --- a/src/cmd/goinstall/main.go +++ b/src/cmd/goinstall/main.go @@ -14,6 +14,7 @@ import ( "io/ioutil" "os" "path/filepath" + "regexp" "runtime" "strings" ) @@ -34,6 +35,7 @@ var ( parents = make(map[string]string) visit = make(map[string]status) installedPkgs = make(map[string]map[string]bool) + schemeRe = regexp.MustCompile(`^[a-z]+://`) allpkg = flag.Bool("a", false, "install all previously installed packages") reportToDashboard = flag.Bool("dashboard", true, "report public packages at "+dashboardURL) @@ -103,8 +105,8 @@ func main() { usage() } for _, path := range args { - if strings.HasPrefix(path, "http://") { - errorf("'http://' used in remote path, try '%s'\n", path[7:]) + if s := schemeRe.FindString(path); s != "" { + errorf("%q used in import path, try %q\n", s, path[len(s):]) continue } |
