зеркало из https://github.com/golang/pkgsite.git
internal/source: support example.com domain for testing
For golang/go#44214 Change-Id: I70a3cbfa62cc051949437ecba94b8667d12dff3e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/290896 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
This commit is contained in:
Родитель
b10ab3f178
Коммит
169a49f51b
|
@ -260,6 +260,13 @@ func ModuleInfo(ctx context.Context, client *Client, modulePath, version string)
|
|||
ctx, span := trace.StartSpan(ctx, "source.ModuleInfo")
|
||||
defer span.End()
|
||||
|
||||
// The example.com domain can never be real; it is reserved for testing
|
||||
// (https://en.wikipedia.org/wiki/Example.com). Treat it as if it used
|
||||
// GitHub templates.
|
||||
if strings.HasPrefix(modulePath, "example.com/") {
|
||||
return NewGitHubInfo("https://"+modulePath, "", version), nil
|
||||
}
|
||||
|
||||
if modulePath == stdlib.ModulePath {
|
||||
return newStdlibInfo(version)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче