diff options
| author | Michael Matloob <matloob@golang.org> | 2024-01-17 14:10:26 -0500 |
|---|---|---|
| committer | Michael Matloob <matloob@golang.org> | 2024-01-23 15:28:52 +0000 |
| commit | c7eaeb891e256eea9575c5d1a33c3458161db86f (patch) | |
| tree | cdde74bda5f4833f600fe1cd36cd5c5ad23b7cac /internal/testing/sample | |
| parent | 506adfeab1ce4a0423fcfd861f0fb728202831a8 (diff) | |
| download | go-x-pkgsite-c7eaeb891e256eea9575c5d1a33c3458161db86f.tar.xz | |
internal: move UnitMeta.IsRedistributable to Unit
Change-Id: Ia0a18df32d752f20b0400b47860638c7d0910eb7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/556435
Reviewed-by: Jonathan Amsterdam <jba@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'internal/testing/sample')
| -rw-r--r-- | internal/testing/sample/sample.go | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/internal/testing/sample/sample.go b/internal/testing/sample/sample.go index c34bbcda..b417430a 100644 --- a/internal/testing/sample/sample.go +++ b/internal/testing/sample/sample.go @@ -201,9 +201,10 @@ func Module(modulePath, version string, suffixes ...string) *internal.Module { func UnitForModuleRoot(m *internal.ModuleInfo) *internal.Unit { u := &internal.Unit{ - UnitMeta: *UnitMeta(m.ModulePath, m.ModulePath, m.Version, "", m.IsRedistributable), - Licenses: LicenseMetadata(), - LicenseContents: Licenses(), + UnitMeta: *UnitMeta(m.ModulePath, m.ModulePath, m.Version, "", m.IsRedistributable), + IsRedistributable: m.IsRedistributable, + Licenses: LicenseMetadata(), + LicenseContents: Licenses(), } u.Readme = &internal.Readme{ Filepath: ReadmeFilePath, @@ -224,13 +225,14 @@ func UnitForPackage(path, modulePath, version, name string, isRedistributable bo doc := *Doc imps := Imports() return &internal.Unit{ - UnitMeta: *UnitMeta(path, modulePath, version, name, isRedistributable), - Licenses: LicenseMetadata(), - Documentation: []*internal.Documentation{&doc}, - BuildContexts: []internal.BuildContext{{GOOS: doc.GOOS, GOARCH: doc.GOARCH}}, - LicenseContents: Licenses(), - Imports: imps, - NumImports: len(imps), + UnitMeta: *UnitMeta(path, modulePath, version, name, isRedistributable), + IsRedistributable: isRedistributable, + Licenses: LicenseMetadata(), + Documentation: []*internal.Documentation{&doc}, + BuildContexts: []internal.BuildContext{{GOOS: doc.GOOS, GOARCH: doc.GOARCH}}, + LicenseContents: Licenses(), + Imports: imps, + NumImports: len(imps), } } @@ -338,21 +340,21 @@ func replaceLicense(lic *licenses.License, lics []*licenses.License) { func UnitEmpty(path, modulePath, version string) *internal.Unit { return &internal.Unit{ - UnitMeta: *UnitMeta(path, modulePath, version, "", true), - Licenses: LicenseMetadata(), + UnitMeta: *UnitMeta(path, modulePath, version, "", true), + IsRedistributable: true, + Licenses: LicenseMetadata(), } } -func UnitMeta(path, modulePath, version, name string, isRedistributable bool) *internal.UnitMeta { +func UnitMeta(path, modulePath, version, name string, moduleIsRedistributable bool) *internal.UnitMeta { return &internal.UnitMeta{ - Path: path, - Name: name, - IsRedistributable: isRedistributable, + Path: path, + Name: name, ModuleInfo: internal.ModuleInfo{ ModulePath: modulePath, Version: version, CommitTime: NowTruncated(), - IsRedistributable: isRedistributable, + IsRedistributable: moduleIsRedistributable, SourceInfo: source.NewGitHubInfo("https://"+modulePath, "", version), }, } |
