aboutsummaryrefslogtreecommitdiff
path: root/internal/testing/sample/sample.go
diff options
context:
space:
mode:
authorJulie Qiu <julie@golang.org>2020-08-31 23:25:42 -0400
committerJulie Qiu <julie@golang.org>2020-09-01 14:32:55 +0000
commitb47aad8790a3780b9e7979e5f94c01da0d7bb100 (patch)
treed0e5bd5f01a5b185472f0bece391ab796da75aa2 /internal/testing/sample/sample.go
parent0dbaeaf4674211c66175ad1bbf728ad69b5cee42 (diff)
downloadgo-x-pkgsite-b47aad8790a3780b9e7979e5f94c01da0d7bb100.tar.xz
internal/postgres: add data to PathInfo
The following fields are added to GetPathInfo: - CommitTime - License metadata - RepositoryURL - PackageSourceURL For golang/go#39629 Change-Id: I664a0e96647ae2ad2404631e27f714b64db5c79c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251919 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/testing/sample/sample.go')
-rw-r--r--internal/testing/sample/sample.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/testing/sample/sample.go b/internal/testing/sample/sample.go
index ea2d21bc..bb519696 100644
--- a/internal/testing/sample/sample.go
+++ b/internal/testing/sample/sample.go
@@ -300,6 +300,18 @@ func UnitForPackage(pkg *internal.LegacyPackage) *internal.Unit {
}
}
+func PathInfo(path, modulePath, version, name string, isRedistributable bool) *internal.PathInfo {
+ return &internal.PathInfo{
+ ModulePath: modulePath,
+ Version: version,
+ Path: path,
+ Name: name,
+ IsRedistributable: isRedistributable,
+ Licenses: LicenseMetadata,
+ SourceInfo: source.NewGitHubInfo("https://"+modulePath, "", version),
+ }
+}
+
func fullPath(modulePath, suffix string) string {
if modulePath != stdlib.ModulePath {
return path.Join(modulePath, suffix)