diff options
author | Russ Cox <rsc@golang.org> | 2014-09-26 13:47:51 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-09-26 13:47:51 -0400 |
commit | 2d475eb2623625e3a6f3c6c46545a692371b4e1f (patch) | |
tree | f315c3762a7465fcddc546b15351bbf7a063ebae | |
parent | 7ca1c77b184fb992355fc6d6439d5359276e9c79 (diff) | |
download | go-2d475eb2623625e3a6f3c6c46545a692371b4e1f.tar.gz |
cmd/go: make malformed import path message more precise
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 issue 7432.
LGTM=r
R=golang-codereviews, r
CC=bradfitz, golang-codereviews, iant
https://codereview.appspot.com/144650043
-rw-r--r-- | src/cmd/go/vcs.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/go/vcs.go b/src/cmd/go/vcs.go index 103b67b82..0834a7d19 100644 --- a/src/cmd/go/vcs.go +++ b/src/cmd/go/vcs.go @@ -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 { |