diff options
| author | Julie Qiu <julie@golang.org> | 2020-09-01 23:03:56 -0400 |
|---|---|---|
| committer | Julie Qiu <julie@golang.org> | 2020-09-02 17:14:50 +0000 |
| commit | d6c70eec19f84ba2f0531a37db5d030073da504a (patch) | |
| tree | 532af6c2916bbd8d19b24763d28f7b25b7fbc6d9 /internal/testing/sample/sample.go | |
| parent | b795075c291073a479c9c50a8815516eb650d785 (diff) | |
| download | go-x-pkgsite-d6c70eec19f84ba2f0531a37db5d030073da504a.tar.xz | |
internal: add WithSubdirectories support to GetUnit
GetUnit now returns the subdirectories for that unit, when the
WithSubdirectories fieldset is provided.
For golang/go#39629
Change-Id: I3976cfec67bc70fc2d532583f2ab2d2af14eada1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/252401
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.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/testing/sample/sample.go b/internal/testing/sample/sample.go index 813d4dc2..3e2d8c25 100644 --- a/internal/testing/sample/sample.go +++ b/internal/testing/sample/sample.go @@ -101,7 +101,7 @@ func NowTruncated() time.Time { // // The package name is last component of the package path. func LegacyPackage(modulePath, suffix string) *internal.LegacyPackage { - p := fullPath(modulePath, suffix) + p := constructFullPath(modulePath, suffix) return &internal.LegacyPackage{ Name: path.Base(p), Path: p, @@ -117,7 +117,7 @@ func LegacyPackage(modulePath, suffix string) *internal.LegacyPackage { } func DirectoryMeta(modulePath, suffix, version string) *internal.DirectoryMeta { - p := fullPath(modulePath, suffix) + p := constructFullPath(modulePath, suffix) return &internal.DirectoryMeta{ ModuleInfo: *ModuleInfo(modulePath, version), Path: p, @@ -127,11 +127,11 @@ func DirectoryMeta(modulePath, suffix, version string) *internal.DirectoryMeta { } } -func PackageMeta(modulePath, suffix string) *internal.PackageMeta { +func PackageMeta(fullPath string) *internal.PackageMeta { return &internal.PackageMeta{ - Path: fullPath(modulePath, suffix), + Path: fullPath, IsRedistributable: true, - Name: path.Base(fullPath(modulePath, suffix)), + Name: path.Base(fullPath), Synopsis: Synopsis, Licenses: LicenseMetadata, } @@ -299,7 +299,7 @@ func UnitMeta(path, modulePath, version, name string, isRedistributable bool) *i } } -func fullPath(modulePath, suffix string) string { +func constructFullPath(modulePath, suffix string) string { if modulePath != stdlib.ModulePath { return path.Join(modulePath, suffix) } |
