]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: make malformed import path message more precise
authorRuss Cox <rsc@golang.org>
Fri, 26 Sep 2014 17:47:51 +0000 (13:47 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 26 Sep 2014 17:47:51 +0000 (13:47 -0400)
If you say 'go get -v' you get extra information when import
paths are not of the expected form.

If you say 'go get -v src/rsc.io/pdf' the message says that
src/rsc.io/pdf does not contain a hostname, which is incorrect.
The problem is that it does not begin with a hostname.

Fixes #7432.

LGTM=r
R=golang-codereviews, r
CC=bradfitz, golang-codereviews, iant
https://golang.org/cl/144650043

src/cmd/go/vcs.go

index 103b67b827445237455794cefd9a5d95ab1ffb35..0834a7d192df7fe32176e6d4234c2a34d2d8345a 100644 (file)
@@ -539,11 +539,11 @@ func repoRootForImportPathStatic(importPath, scheme string) (*repoRoot, error) {
 func repoRootForImportDynamic(importPath string) (*repoRoot, error) {
        slash := strings.Index(importPath, "/")
        if slash < 0 {
-               return nil, errors.New("import path doesn't contain a slash")
+               return nil, errors.New("import path does not contain a slash")
        }
        host := importPath[:slash]
        if !strings.Contains(host, ".") {
-               return nil, errors.New("import path doesn't contain a hostname")
+               return nil, errors.New("import path does not begin with hostname")
        }
        urlStr, body, err := httpsOrHTTP(importPath)
        if err != nil {