Skip to content

Commit dbf452d

Browse files
committed
Ensure all required options are set in validate
1 parent 390b445 commit dbf452d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/verify.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ type VerifyGCOptions struct {
5050

5151
// Validate ensures the specified options are valid
5252
func (v *VerifyGCOptions) Validate() error {
53+
if v.DiscoveryClient == nil {
54+
return fmt.Errorf("discovery client is required")
55+
}
56+
if v.MetadataClient == nil {
57+
return fmt.Errorf("metadata client is required")
58+
}
59+
if v.Stderr == nil {
60+
return fmt.Errorf("stderr is required")
61+
}
62+
if v.Stdout == nil {
63+
return fmt.Errorf("stdout is required")
64+
}
5365
if v.Output != "" && v.Output != "json" {
5466
return fmt.Errorf("invalid output format, only '' and 'json' are supported: %v", v.Output)
5567
}

0 commit comments

Comments
 (0)