opts should not be a pointer

This commit is contained in:
Yann Hamon 2020-11-14 15:57:39 +01:00
parent 649c2ca4d6
commit 9936e43d47
3 changed files with 4 additions and 4 deletions

View file

@ -65,7 +65,7 @@ func realMain() int {
return 1
}
v := validator.New(cfg.SchemaLocations, &validator.Opts{
v := validator.New(cfg.SchemaLocations, validator.Opts{
SkipTLS: cfg.SkipTLS,
SkipKinds: cfg.SkipKinds,
RejectKinds: cfg.RejectKinds,

View file

@ -22,7 +22,7 @@ const (
)
type Validator struct {
opts *Opts
opts Opts
schemaCache *cache.SchemaCache
schemaDownload func(registries []registry.Registry, kind, version, k8sVersion string) (*gojsonschema.Schema, error)
regs []registry.Registry
@ -58,7 +58,7 @@ func downloadSchema(registries []registry.Registry, kind, version, k8sVersion st
return nil, nil // No schema found - we don't consider it an error, resource will be skipped
}
func New(schemaLocations []string, opts *Opts) *Validator {
func New(schemaLocations []string, opts Opts) *Validator {
registries := []registry.Registry{}
for _, schemaLocation := range schemaLocations {
registries = append(registries, registry.New(schemaLocation, opts.Strict, opts.SkipTLS))

View file

@ -135,7 +135,7 @@ lastName: bar
},
} {
v := Validator{
opts: &Opts{
opts: Opts{
SkipKinds: map[string]bool{},
RejectKinds: map[string]bool{},
},