From 7423eb3db867d3209615dba639c16cb970623d9e Mon Sep 17 00:00:00 2001 From: Michael Sverdlov Date: Wed, 30 Oct 2024 16:42:04 +0200 Subject: [PATCH] Improve repositores code Signed-off-by: Michael Sverdlov --- artifactory/commands/golang/go.go | 8 ++++++++ artifactory/commands/golang/publish.go | 10 +--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/artifactory/commands/golang/go.go b/artifactory/commands/golang/go.go index f2a96ffa2..6671589c7 100644 --- a/artifactory/commands/golang/go.go +++ b/artifactory/commands/golang/go.go @@ -413,3 +413,11 @@ func getArtifactoryApiUrl(repoName string, details auth.ServiceDetails, goProxyP return goProxyParams.BuildUrl(rtUrl, repoName), nil } + +func GetModuleName(projectDir string) (string, error) { + path, err := biutils.GetModuleNameByDir(projectDir, log.Logger) + if err != nil { + return "", errorutils.CheckError(err) + } + return path, nil +} diff --git a/artifactory/commands/golang/publish.go b/artifactory/commands/golang/publish.go index 27753f626..30e7d799a 100644 --- a/artifactory/commands/golang/publish.go +++ b/artifactory/commands/golang/publish.go @@ -34,7 +34,7 @@ func publishPackage(packageVersion, targetRepo, buildName, buildNumber, projectK } // Read module name - moduleName, err := getModuleName(projectPath) + moduleName, err := GetModuleName(projectPath) if err != nil { return nil, nil, err } @@ -246,11 +246,3 @@ func getProjectRoot() (string, error) { } return path, nil } - -func getModuleName(projectDir string) (string, error) { - path, err := utils.GetModuleNameByDir(projectDir, log.Logger) - if err != nil { - return "", errorutils.CheckError(err) - } - return path, nil -}