| 194 | } |
| 195 | |
| 196 | func (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, |