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