Commit 83305fec authored by Andrew Gerrand's avatar Andrew Gerrand

goinstall: abort and warn when using any url scheme, not just 'http://'

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4801053
parent 75c918c1
...@@ -14,6 +14,7 @@ import ( ...@@ -14,6 +14,7 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"regexp"
"runtime" "runtime"
"strings" "strings"
) )
...@@ -34,6 +35,7 @@ var ( ...@@ -34,6 +35,7 @@ var (
parents = make(map[string]string) parents = make(map[string]string)
visit = make(map[string]status) visit = make(map[string]status)
installedPkgs = make(map[string]map[string]bool) installedPkgs = make(map[string]map[string]bool)
schemeRe = regexp.MustCompile(`^[a-z]+://`)
allpkg = flag.Bool("a", false, "install all previously installed packages") allpkg = flag.Bool("a", false, "install all previously installed packages")
reportToDashboard = flag.Bool("dashboard", true, "report public packages at "+dashboardURL) reportToDashboard = flag.Bool("dashboard", true, "report public packages at "+dashboardURL)
...@@ -103,8 +105,8 @@ func main() { ...@@ -103,8 +105,8 @@ func main() {
usage() usage()
} }
for _, path := range args { for _, path := range args {
if strings.HasPrefix(path, "http://") { if s := schemeRe.FindString(path); s != "" {
errorf("'http://' used in remote path, try '%s'\n", path[7:]) errorf("%q used in import path, try %q\n", s, path[len(s):])
continue continue
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment