| 471 | } |
| 472 | |
| 473 | func hashValidation(val *expr.ValidationExpr, h hash.Hash64) uint64 { |
| 474 | // Note: we can't use hashstructure for attributes because it doesn't |
| 475 | // handle recursive structures. |
| 476 | if val == nil { |
| 477 | return 0 |
| 478 | } |
| 479 | |
| 480 | res, err := hashstructure.Hash(val, &hashstructure.HashOptions{ |
| 481 | Hasher: h, |
| 482 | ZeroNil: false, |
| 483 | IgnoreZeroValue: true, |
| 484 | SlicesAsSets: true, |
| 485 | }) |
| 486 | if err != nil { |
| 487 | // should really never happen (OOM maybe) |
| 488 | return 0 |
| 489 | } |
| 490 | return res |
| 491 | } |
| 492 | |
| 493 | func hashString(s string, h hash.Hash64) uint64 { |
| 494 | h.Reset() |