зеркало из https://github.com/golang/pkgsite.git
internal/source: fix documentation
source.ModuleInfo is incorrectly documented as source.LegacyModuleInfo, which is now fixed. A comment in RawURL is also fixed. For golang/go#39629 Change-Id: I30b650f2895970e36446659a02a6f3e8e54ef578 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258301 Reviewed-by: Jamal Carvalho <jamal@golang.org> Trust: Julie Qiu <julie@golang.org>
This commit is contained in:
Родитель
8cc2d1307c
Коммит
677d50839f
|
@ -126,8 +126,8 @@ func (i *Info) RawURL(pathname string) string {
|
|||
// Special case: the standard library's source module path is set to "src",
|
||||
// which is correct for source file links. But the README is at the repo
|
||||
// root, not in the src directory. In other words,
|
||||
// VersionInfo.LegacyReadmeFilePath is not relative to
|
||||
// VersionInfo.SourceInfo.moduleDir, as it is for every other module.
|
||||
// Module.Units[0].Readme.FilePath is not relative to
|
||||
// Module.Units[0].SourceInfo.moduleDir, as it is for every other module.
|
||||
// Correct for that here.
|
||||
if i.repoURL == stdlib.GoSourceRepoURL {
|
||||
moduleDir = ""
|
||||
|
@ -242,14 +242,14 @@ func (c *Client) doURL(ctx context.Context, method, url string, only200 bool) (_
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
// LegacyModuleInfo determines the repository corresponding to the module path. It
|
||||
// ModuleInfo determines the repository corresponding to the module path. It
|
||||
// returns a URL to that repo, as well as the directory of the module relative
|
||||
// to the repo root.
|
||||
//
|
||||
// LegacyModuleInfo may fetch from arbitrary URLs, so it can be slow.
|
||||
// ModuleInfo may fetch from arbitrary URLs, so it can be slow.
|
||||
func ModuleInfo(ctx context.Context, client *Client, modulePath, version string) (info *Info, err error) {
|
||||
defer derrors.Wrap(&err, "source.LegacyModuleInfo(ctx, %q, %q)", modulePath, version)
|
||||
ctx, span := trace.StartSpan(ctx, "source.LegacyModuleInfo")
|
||||
defer derrors.Wrap(&err, "source.ModuleInfo(ctx, %q, %q)", modulePath, version)
|
||||
ctx, span := trace.StartSpan(ctx, "source.ModuleInfo")
|
||||
defer span.End()
|
||||
|
||||
if modulePath == stdlib.ModulePath {
|
||||
|
|
Загрузка…
Ссылка в новой задаче