diff --git a/pkg/config/package.go b/pkg/config/package.go index 88b05f7ca..0c4355f2e 100644 --- a/pkg/config/package.go +++ b/pkg/config/package.go @@ -311,6 +311,11 @@ func (cpkg *Package) RenderURL(rt *runtime.Runtime) (string, error) { return s, nil } +func (cpkg *Package) RenderPath() (string, error) { + pkgInfo := cpkg.PackageInfo + return cpkg.RenderTemplateString(pkgInfo.GetPath(), &runtime.Runtime{}) +} + func (cpkg *Package) GetPkgPath(rootDir string, rt *runtime.Runtime) (string, error) { pkgInfo := cpkg.PackageInfo pkg := cpkg.Package @@ -324,7 +329,11 @@ func (cpkg *Package) GetPkgPath(rootDir string, rt *runtime.Runtime) (string, er case PkgInfoTypeGo: return filepath.Join(rootDir, "pkgs", pkgInfo.GetType(), "github.com", pkgInfo.RepoOwner, pkgInfo.RepoName, pkg.Version, "src"), nil case PkgInfoTypeGoInstall: - return filepath.Join(rootDir, "pkgs", pkgInfo.GetType(), pkgInfo.GetPath(), pkg.Version, "bin"), nil + p, err := cpkg.RenderPath() + if err != nil { + return "", fmt.Errorf("render Go Module Path: %w", err) + } + return filepath.Join(rootDir, "pkgs", pkgInfo.GetType(), p, pkg.Version, "bin"), nil case PkgInfoTypeGitHubContent, PkgInfoTypeGitHubRelease: return filepath.Join(rootDir, "pkgs", pkgInfo.GetType(), "github.com", pkgInfo.RepoOwner, pkgInfo.RepoName, pkg.Version, assetName), nil case PkgInfoTypeHTTP: diff --git a/pkg/installpackage/download.go b/pkg/installpackage/download.go index c78f29609..66d74e68e 100644 --- a/pkg/installpackage/download.go +++ b/pkg/installpackage/download.go @@ -188,8 +188,11 @@ func (inst *Installer) download(ctx context.Context, logE *logrus.Entry, param * } func (inst *Installer) downloadGoInstall(ctx context.Context, pkg *config.Package, dest string, logE *logrus.Entry) error { - pkgInfo := pkg.PackageInfo - goPkgPath := pkgInfo.GetPath() + "@" + pkg.Package.Version + p, err := pkg.RenderPath() + if err != nil { + return fmt.Errorf("render Go Module Path: %w", err) + } + goPkgPath := p + "@" + pkg.Package.Version logE.WithFields(logrus.Fields{ "gobin": dest, "go_package_path": goPkgPath,