mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 06:16:08 -04:00
deps: replace multierr with native errors.Join
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
955316c661
commit
12c866bcb9
32 changed files with 173 additions and 159 deletions
|
@ -7,12 +7,12 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
package versionsapi
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"path"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/internal/constants"
|
||||
"go.uber.org/multierr"
|
||||
"golang.org/x/mod/semver"
|
||||
)
|
||||
|
||||
|
@ -54,16 +54,16 @@ func (l Latest) URL() (string, error) {
|
|||
func (l Latest) Validate() error {
|
||||
var retErr error
|
||||
if err := ValidateRef(l.Ref); err != nil {
|
||||
retErr = multierr.Append(retErr, err)
|
||||
retErr = errors.Join(retErr, err)
|
||||
}
|
||||
if err := ValidateStream(l.Ref, l.Stream); err != nil {
|
||||
retErr = multierr.Append(retErr, err)
|
||||
retErr = errors.Join(retErr, err)
|
||||
}
|
||||
if l.Kind == VersionKindUnknown {
|
||||
retErr = multierr.Append(retErr, fmt.Errorf("version of kind %q is not supported", l.Kind))
|
||||
retErr = errors.Join(retErr, fmt.Errorf("version of kind %q is not supported", l.Kind))
|
||||
}
|
||||
if !semver.IsValid(l.Version) {
|
||||
retErr = multierr.Append(retErr, fmt.Errorf("version %q is not a valid semver", l.Version))
|
||||
retErr = errors.Join(retErr, fmt.Errorf("version %q is not a valid semver", l.Version))
|
||||
}
|
||||
|
||||
return retErr
|
||||
|
@ -73,16 +73,16 @@ func (l Latest) Validate() error {
|
|||
func (l Latest) ValidateRequest() error {
|
||||
var retErr error
|
||||
if err := ValidateRef(l.Ref); err != nil {
|
||||
retErr = multierr.Append(retErr, err)
|
||||
retErr = errors.Join(retErr, err)
|
||||
}
|
||||
if err := ValidateStream(l.Ref, l.Stream); err != nil {
|
||||
retErr = multierr.Append(retErr, err)
|
||||
retErr = errors.Join(retErr, err)
|
||||
}
|
||||
if l.Kind == VersionKindUnknown {
|
||||
retErr = multierr.Append(retErr, fmt.Errorf("version of kind %q is not supported", l.Kind))
|
||||
retErr = errors.Join(retErr, fmt.Errorf("version of kind %q is not supported", l.Kind))
|
||||
}
|
||||
if l.Version != "" {
|
||||
retErr = multierr.Append(retErr, fmt.Errorf("version %q must be empty for request", l.Version))
|
||||
retErr = errors.Join(retErr, fmt.Errorf("version %q must be empty for request", l.Version))
|
||||
}
|
||||
return retErr
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue