From 298ab36c0b34ba472c4e8f61acdab4becedd1b54 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 8 Aug 2024 06:03:10 -0700 Subject: [PATCH] Fix import prefix trailing slash (#20) --- config.go | 9 ++++++++- generate_package.go | 4 ++-- generate_package_test.go | 4 ++-- go.mod | 8 +++++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/config.go b/config.go index bea57c7..b30d67e 100644 --- a/config.go +++ b/config.go @@ -26,6 +26,14 @@ type repository struct { Website website `json:"website"` } +func (r repository) PrefixPath() string { + if r.Prefix == "" { + return "" + } else { + return "/" + r.Prefix + } +} + func (r repository) Packages() []string { pkgs := []string{r.Prefix} for i := range r.Subs { @@ -75,7 +83,6 @@ type website struct { func parseConfig(r io.Reader) (config, error) { bytes, err := ioutil.ReadAll(r) - if err != nil { return config{}, err } diff --git a/generate_package.go b/generate_package.go index 3e0d77e..6484002 100644 --- a/generate_package.go +++ b/generate_package.go @@ -13,8 +13,8 @@ func generate_package(w io.Writer, domain, docsDomain, pkg string, r repository)