summaryrefslogtreecommitdiff
path: root/src/cmd/go/vcs.go
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2012-05-02 15:44:51 +0200
committerOndřej Surý <ondrej@sury.org>2012-05-02 15:44:51 +0200
commit0003ee229fd33ff46cb5f2fe1e35f5c0284debc4 (patch)
tree08c48264fd22152f443284397517a1b2be743c34 /src/cmd/go/vcs.go
parent505c19580e0f43fe5224431459cacb7c21edd93d (diff)
downloadgolang-0003ee229fd33ff46cb5f2fe1e35f5c0284debc4.tar.gz
Imported Upstream version 1.0.1upstream/1.0.1
Diffstat (limited to 'src/cmd/go/vcs.go')
-rw-r--r--src/cmd/go/vcs.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cmd/go/vcs.go b/src/cmd/go/vcs.go
index 5f63f8b56..1c121672f 100644
--- a/src/cmd/go/vcs.go
+++ b/src/cmd/go/vcs.go
@@ -422,11 +422,15 @@ func repoRootForImportPathStatic(importPath, scheme string) (*repoRoot, error) {
func repoRootForImportDynamic(importPath string) (*repoRoot, error) {
slash := strings.Index(importPath, "/")
if slash < 0 {
- return nil, fmt.Errorf("missing / in import %q", importPath)
+ return nil, errors.New("import path doesn't contain a slash")
+ }
+ host := importPath[:slash]
+ if !strings.Contains(host, ".") {
+ return nil, errors.New("import path doesn't contain a hostname")
}
urlStr, body, err := httpsOrHTTP(importPath)
if err != nil {
- return nil, fmt.Errorf("http/https fetch for import %q: %v", importPath, err)
+ return nil, fmt.Errorf("http/https fetch: %v", err)
}
defer body.Close()
metaImport, err := matchGoImport(parseMetaGoImports(body), importPath)