From d7e960f0c12e6f95faa0f227a650aa9f987472ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Tue, 10 Oct 2023 11:47:12 +0200 Subject: [PATCH] Internal: delete unused `common.VersionLessThan()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function is a leftover from the image definitions split and it is not used. Moreover, the `images` copy of it is being reimplemented by [1]. It is better to remove this copy to prevent any unintended use of it or confusion. [1] https://github.com/osbuild/images/pull/195 Signed-off-by: Tomáš Hozza --- internal/common/distro.go | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/internal/common/distro.go b/internal/common/distro.go index 9f8500719..ade88be36 100644 --- a/internal/common/distro.go +++ b/internal/common/distro.go @@ -51,33 +51,3 @@ func readOSRelease(r io.Reader) (map[string]string, error) { return osrelease, nil } - -// Returns true if the version represented by the first argument is -// semantically older than the second. -// Meant to be used for comparing distro versions for differences between minor -// releases. -// Evaluates to false if a and b are equal. -// Assumes any missing components are 0, so 8 < 8.1. -func VersionLessThan(a, b string) bool { - aParts := strings.Split(a, ".") - bParts := strings.Split(b, ".") - - // pad shortest argument with zeroes - for len(aParts) < len(bParts) { - aParts = append(aParts, "0") - } - for len(bParts) < len(aParts) { - bParts = append(bParts, "0") - } - - for idx := 0; idx < len(aParts); idx++ { - if aParts[idx] < bParts[idx] { - return true - } else if aParts[idx] > bParts[idx] { - return false - } - } - - // equal - return false -}