mirror of
https://github.com/golang/go
synced 2024-11-05 17:06:13 -07: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:
parent
2b78567943
commit
157f8abbbd
@ -478,11 +478,11 @@ func RepoRootForImportPathStatic(importPath, scheme string) (*RepoRoot, error) {
|
|||||||
// RepoRootForImportDynamic finds a *RepoRoot for a custom domain that's not
|
// RepoRootForImportDynamic finds a *RepoRoot for a custom domain that's not
|
||||||
// statically known by RepoRootForImportPathStatic.
|
// 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) {
|
func RepoRootForImportDynamic(importPath string, verbose bool) (*RepoRoot, error) {
|
||||||
slash := strings.Index(importPath, "/")
|
slash := strings.Index(importPath, "/")
|
||||||
if slash < 0 {
|
if slash < 0 {
|
||||||
return nil, errors.New("import path doesn't contain a slash")
|
slash = len(importPath)
|
||||||
}
|
}
|
||||||
host := importPath[:slash]
|
host := importPath[:slash]
|
||||||
if !strings.Contains(host, ".") {
|
if !strings.Contains(host, ".") {
|
||||||
|
Loading…
Reference in New Issue
Block a user