1
0
mirror of https://github.com/golang/go synced 2024-09-30 16:18:35 -06:00

go/vcs: accept domain.root in RepoRootForImportDynamic

This is the same change as in https://golang.org/cl/12193.

Fixes golang/go#13506.

Related to golang/go#9357.

Change-Id: I9c7d956008641b1907e14bcb08198235f5f9552f
Reviewed-on: https://go-review.googlesource.com/18152
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Dmitri Shuralyov 2015-12-28 21:19:58 -08:00 committed by Russ Cox
parent 2b78567943
commit 157f8abbbd

View File

@ -478,11 +478,11 @@ func RepoRootForImportPathStatic(importPath, scheme string) (*RepoRoot, error) {
// RepoRootForImportDynamic finds a *RepoRoot for a custom domain that's not
// statically known by RepoRootForImportPathStatic.
//
// This handles "vanity import paths" like "name.tld/pkg/foo".
// This handles custom import paths like "name.tld/pkg/foo" or just "name.tld".
func RepoRootForImportDynamic(importPath string, verbose bool) (*RepoRoot, error) {
slash := strings.Index(importPath, "/")
if slash < 0 {
return nil, errors.New("import path doesn't contain a slash")
slash = len(importPath)
}
host := importPath[:slash]
if !strings.Contains(host, ".") {