Skip to content

Commit

Permalink
Merge pull request #9175 from killianmuldoon/pr-replace-go-multierror
Browse files Browse the repository at this point in the history
🌱 Replace hashicorp/go-multierror with kerrors
  • Loading branch information
k8s-ci-robot authored Aug 14, 2023
2 parents c3a2e86 + cd595fb commit 9903654
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
17 changes: 10 additions & 7 deletions hack/tools/conversion-verifier/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ limitations under the License.
package main

import (
"fmt"
"go/types"
"path"
"strings"

"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"k8s.io/klog/v2"
crdmarkers "sigs.k8s.io/controller-tools/pkg/crd/markers"
Expand Down Expand Up @@ -70,7 +70,7 @@ func (s *storageVersionType) IsHub() bool {
}

func main() {
var result error
var errs []error

// Define the marker collector.
col := &markers.Collector{
Expand Down Expand Up @@ -118,7 +118,7 @@ func main() {
return
}
if _, ok := storageVersionTypes[info.Name]; ok {
result = multierror.Append(result,
errs = append(errs,
errors.Errorf("type %q has a redeclared storage version in package %q", info.Name, pkg.PkgPath),
)
return
Expand Down Expand Up @@ -197,21 +197,24 @@ func main() {
}

if !storageType.IsHub() {
result = multierror.Append(result,
errs = append(errs,
errors.Errorf("type %q in package %q marked as storage version but it's not convertible, missing Hub() method", name, storageType.pkg.PkgPath),
)
}
for _, decl := range storageType.otherDecls {
if !decl.IsConvertible() {
result = multierror.Append(result,
errs = append(errs,
errors.Errorf("type %q in package %q it's not convertible, missing ConvertFrom() and ConvertTo() methods", name, decl.pkg.PkgPath),
)
}
}
}

if result != nil {
klog.Exit(result.Error())
if len(errs) > 0 {
fmt.Printf("%d errors occurred:\n", len(errs))
for _, err := range errs {
fmt.Printf("\t* %s\n", err)
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions hack/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ replace sigs.k8s.io/cluster-api/test => ../../test
require (
cloud.google.com/go/storage v1.31.0
github.com/blang/semver v3.5.1+incompatible
github.com/hashicorp/go-multierror v1.1.1
github.com/pkg/errors v0.9.1
github.com/spf13/pflag v1.0.5
github.com/valyala/fastjson v1.6.4
Expand Down Expand Up @@ -80,7 +79,6 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.13 // indirect
Expand Down
4 changes: 0 additions & 4 deletions hack/tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,10 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFb
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
Expand Down

0 comments on commit 9903654

Please sign in to comment.