MCPcopy
hub / github.com/google/go-cmp / filter

Method filter

cmp/options.go:68–87  ·  view source on GitHub ↗
(s *state, t reflect.Type, vx, vy reflect.Value)

Source from the content-addressed store, hash-verified

66type Options []Option
67
68func (opts Options) filter(s *state, t reflect.Type, vx, vy reflect.Value) (out applicableOption) {
69 for _, opt := range opts {
70 switch opt := opt.filter(s, t, vx, vy); opt.(type) {
71 case ignore:
72 return ignore{} // Only ignore can short-circuit evaluation
73 case validator:
74 out = validator{} // Takes precedence over comparer or transformer
75 case *comparer, *transformer, Options:
76 switch out.(type) {
77 case nil:
78 out = opt
79 case validator:
80 // Keep validator
81 case *comparer, *transformer, Options:
82 out = Options{out, opt} // Conflicting comparers or transformers
83 }
84 }
85 }
86 return out
87}
88
89func (opts Options) apply(s *state, _, _ reflect.Value) {
90 const warning = "ambiguous set of applicable options"

Callers

nothing calls this directly

Calls 1

filterMethod · 0.65

Tested by

no test coverage detected