Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Replace hashicorp/go-multierror with kerrors #9175

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indirect dep is brought in by viper

> go mod why -m github.com/hashicorp/hcl

# github.com/hashicorp/hcl
sigs.k8s.io/cluster-api/cmd/clusterctl/client/config
github.com/spf13/viper
github.com/spf13/viper/internal/encoding/hcl
github.com/hashicorp/hcl

We have a number of other indirect hashicorp dependencies in our go.sum - but I think all of them are going to remain at MPL for now.

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
Loading