From 254a8e057fd3093fafb942165aaa4b83fd9aa335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20W=C3=A5reus?= Date: Tue, 12 Dec 2023 14:28:17 +0100 Subject: [PATCH] fix typos and remove comments --- internal/resolution/pm/pip/job.go | 9 ++------- internal/resolution/pm/util/error.go | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/internal/resolution/pm/pip/job.go b/internal/resolution/pm/pip/job.go index 6bf8f76f..ffde27d5 100644 --- a/internal/resolution/pm/pip/job.go +++ b/internal/resolution/pm/pip/job.go @@ -142,29 +142,24 @@ func (j *Job) handleInstallError(cmdErr job.IError) { []string{ "Failed to install python dependency ", dependencyName, - " due to authorization.\n" + util.InstalLPrivateDependencyMessage, + " due to authorization.\n" + util.InstallPrivateDependencyMessage, }, ""), ) case couldNotFindVersionError.MatchString(cmdErr.Error()): - // Define a regex to match the dependency name dependencyNamePattern := regexp.MustCompile(`Could not find a version that satisfies the requirement ([\w=]+)`) dependencyNameMatch := dependencyNamePattern.FindStringSubmatch(cmdErr.Error()) - dependencyName := "" if len(dependencyNameMatch) > 1 { - // Split the dependency name and version dependency := strings.Split(dependencyNameMatch[1], "==") dependencyName = "\"" + dependency[0] + "\"" } - - // Set the documentation string cmdErr.SetDocumentation( strings.Join( []string{ "Failed to find a version that satisfies the requirement for python dependency ", dependencyName, - ". This could mean that the package or version does not exist.\n" + util.InstalLPrivateDependencyMessage, + ". This could mean that the package or version does not exist.\n" + util.InstallPrivateDependencyMessage, }, ""), ) } diff --git a/internal/resolution/pm/util/error.go b/internal/resolution/pm/util/error.go index e7713e41..cccd8657 100644 --- a/internal/resolution/pm/util/error.go +++ b/internal/resolution/pm/util/error.go @@ -7,7 +7,7 @@ type PMJobError struct { status string } -var InstalLPrivateDependencyMessage = "If this is a private dependency, please make sure that the debricked CLI has access to install it or pre-install it before running the debricked CLI." +var InstallPrivateDependencyMessage = "If this is a private dependency, please make sure that the debricked CLI has access to install it or pre-install it before running the debricked CLI." var UnknownError = "No specific documentation for this problem yet. If you would like this message to more informative for this error, please create an issue here: https://github.com/debricked/cli/issues" func (e PMJobError) Error() string {