@@ -17,11 +17,11 @@ limitations under the License.
17
17
package main
18
18
19
19
import (
20
+ "fmt"
20
21
"go/types"
21
22
"path"
22
23
"strings"
23
24
24
- "github.com/hashicorp/go-multierror"
25
25
"github.com/pkg/errors"
26
26
"k8s.io/klog/v2"
27
27
crdmarkers "sigs.k8s.io/controller-tools/pkg/crd/markers"
@@ -70,7 +70,7 @@ func (s *storageVersionType) IsHub() bool {
70
70
}
71
71
72
72
func main () {
73
- var result error
73
+ var errs [] error
74
74
75
75
// Define the marker collector.
76
76
col := & markers.Collector {
@@ -118,7 +118,7 @@ func main() {
118
118
return
119
119
}
120
120
if _ , ok := storageVersionTypes [info .Name ]; ok {
121
- result = multierror . Append ( result ,
121
+ errs = append ( errs ,
122
122
errors .Errorf ("type %q has a redeclared storage version in package %q" , info .Name , pkg .PkgPath ),
123
123
)
124
124
return
@@ -197,21 +197,24 @@ func main() {
197
197
}
198
198
199
199
if ! storageType .IsHub () {
200
- result = multierror . Append ( result ,
200
+ errs = append ( errs ,
201
201
errors .Errorf ("type %q in package %q marked as storage version but it's not convertible, missing Hub() method" , name , storageType .pkg .PkgPath ),
202
202
)
203
203
}
204
204
for _ , decl := range storageType .otherDecls {
205
205
if ! decl .IsConvertible () {
206
- result = multierror . Append ( result ,
206
+ errs = append ( errs ,
207
207
errors .Errorf ("type %q in package %q it's not convertible, missing ConvertFrom() and ConvertTo() methods" , name , decl .pkg .PkgPath ),
208
208
)
209
209
}
210
210
}
211
211
}
212
212
213
- if result != nil {
214
- klog .Exit (result .Error ())
213
+ if len (errs ) > 0 {
214
+ fmt .Printf ("%d errors occurred:\n " , len (errs ))
215
+ for _ , err := range errs {
216
+ fmt .Printf ("\t * %s\n " , err )
217
+ }
215
218
}
216
219
}
217
220
0 commit comments