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

Method processOption

cmp/compare.go:196–218  ·  view source on GitHub ↗
(opt Option)

Source from the content-addressed store, hash-verified

194}
195
196func (s *state) processOption(opt Option) {
197 switch opt := opt.(type) {
198 case nil:
199 case Options:
200 for _, o := range opt {
201 s.processOption(o)
202 }
203 case coreOption:
204 type filtered interface {
205 isFiltered() bool
206 }
207 if fopt, ok := opt.(filtered); ok && !fopt.isFiltered() {
208 panic(fmt.Sprintf("cannot use an unfiltered option: %v", opt))
209 }
210 s.opts = append(s.opts, opt)
211 case exporter:
212 s.exporters = append(s.exporters, opt)
213 case reporter:
214 s.reporters = append(s.reporters, opt)
215 default:
216 panic(fmt.Sprintf("unknown option %T", opt))
217 }
218}
219
220// statelessCompare compares two values and returns the result.
221// This function is stateless in that it does not alter the current result,

Callers 1

newStateFunction · 0.95

Calls 1

isFilteredMethod · 0.65

Tested by

no test coverage detected