uniqueVars returns an error if two slices contain duplicated strings.
(s1, s2 []string)
| 480 | |
| 481 | // uniqueVars returns an error if two slices contain duplicated strings. |
| 482 | func uniqueVars(s1, s2 []string) error { |
| 483 | for _, v1 := range s1 { |
| 484 | for _, v2 := range s2 { |
| 485 | if v1 == v2 { |
| 486 | return fmt.Errorf("mux: duplicated route variable %q", v2) |
| 487 | } |
| 488 | } |
| 489 | } |
| 490 | return nil |
| 491 | } |
| 492 | |
| 493 | // checkPairs returns the count of strings passed in, and an error if |
| 494 | // the count is not an even number. |