From a443bc5c27c5fa9ca0b8674f017fd37da06c50e5 Mon Sep 17 00:00:00 2001
From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com>
Date: Sun, 11 Sep 2022 23:46:01 -0700
Subject: [PATCH] Fix double slashes in single module deployment (#18)
* Add test for a single module deployment
* Fix double slashes in single module deployment
---
config.go | 8 +++++--
generate_package.go | 2 +-
generate_package_test.go | 46 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/config.go b/config.go
index 598685e..bea57c7 100644
--- a/config.go
+++ b/config.go
@@ -28,12 +28,16 @@ type repository struct {
func (r repository) Packages() []string {
pkgs := []string{r.Prefix}
- for _, s := range r.Subs {
- pkgs = append(pkgs, path.Join(r.Prefix, s.Name))
+ for i := range r.Subs {
+ pkgs = append(pkgs, r.SubPath(i))
}
return pkgs
}
+func (r repository) SubPath(i int) string {
+ return path.Join(r.Prefix, r.Subs[i].Name)
+}
+
type sub struct {
Name string
Hidden bool
diff --git a/generate_package.go b/generate_package.go
index 85e7ae8..3e0d77e 100644
--- a/generate_package.go
+++ b/generate_package.go
@@ -31,7 +31,7 @@ ul { margin-top: 16px; margin-bottom: 16px; }
Home: {{.HomeURL}}
Source: {{.Repository.URL}}
{{if .Repository.Subs -}}Sub-packages: