From 1be02ac647ae6499ad3dd8ffecbd9d02d7064f1c Mon Sep 17 00:00:00 2001 From: Florian Loitsch Date: Thu, 28 Sep 2023 14:55:32 +0200 Subject: [PATCH] Remove trailing /. (#50) This typically happened when users used `--project-root`. --- pkg/tpkg/spec.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/tpkg/spec.go b/pkg/tpkg/spec.go index 740ced0..3f0b531 100644 --- a/pkg/tpkg/spec.go +++ b/pkg/tpkg/spec.go @@ -346,6 +346,13 @@ func (s *Spec) visitLocalDeps(ui UI, cb func(pkgPath string, fullPath string, de } } + // 'filepath.Rel' sometimes adds '/.' to the path, which we don't want. + // Generally, just remove any trailing '/.'. + slashDot := string(filepath.Separator) + "." + if pkgPath != slashDot { + pkgPath = strings.TrimSuffix(pkgPath, slashDot) + } + fullPath := pkgPath if !filepath.IsAbs(fullPath) { fullPath = filepath.Join(entryDir, fullPath)