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