From 934fa0598b27f09bc65d8b78471742055cad5d12 Mon Sep 17 00:00:00 2001 From: 5hir0kur0 <12101162+5hir0kur0@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:25:46 +0900 Subject: [PATCH] Remove errors.Join usage for go1.19 compatibility --- deb/package.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/deb/package.go b/deb/package.go index 75553e8f..b56e1c58 100644 --- a/deb/package.go +++ b/deb/package.go @@ -3,7 +3,6 @@ package deb import ( gocontext "context" "encoding/json" - "errors" "fmt" "path/filepath" "strconv" @@ -342,11 +341,10 @@ func (p *Package) MatchesArchitecture(arch string) bool { // providesDependency checks if the package `Provide:`s the dependency, assuming that the architecture matches. // If the `Provides:` entry includes a version number, it will be considered when checking the dependency. func (p *Package) providesDependency(dep Dependency) (bool, error) { - var errs []error // won't cause an allocation in case of no errors for _, provided := range p.Provides { providedDep, err := ParseDependency(provided) if err != nil { - errs = append(errs, err) + return false, err } // The only relation allowed here is `=`. // > The relations allowed are [...]. The exception is the Provides field, for which only = is allowed. @@ -365,10 +363,10 @@ func (p *Package) providesDependency(dep Dependency) (bool, error) { return true, nil } default: - errs = append(errs, fmt.Errorf("unsupported relation in Provides: %s", providedDep.String())) + return false, fmt.Errorf("unsupported relation in Provides: %s", providedDep.String()) } } - return false, errors.Join(errs...) + return false, nil } // MatchesDependency checks whether package matches specified dependency