validateIntRange validates that a value is within the specified inclusive range [min, max]. It returns an error if the value is outside the range, with a descriptive message including the field name and the actual value. Parameters: - value: The integer value to validate - min: The minimum allowed
(value, min, max int, fieldName string)
| 69 | // return err |
| 70 | // } |
| 71 | func validateIntRange(value, min, max int, fieldName string) error { |
| 72 | if value < min || value > max { |
| 73 | return fmt.Errorf("%s must be between %d and %d, got %d", |
| 74 | fieldName, min, max, value) |
| 75 | } |
| 76 | return nil |
| 77 | } |
| 78 | |
| 79 | // validateMountStringFormat parses a mount string and validates its basic format. |
| 80 | // Expected format: "source:destination:mode" where mode is "ro" or "rw". |