ValidateDockerCompat implements docker compatible identifier validation. The containerd implementation allows single character identifiers, while the Docker compatible implementation requires at least 2 characters for identifiers. The containerd implementation enforces a maximum length constraint of
(s string)
| 34 | // The containerd implementation enforces a maximum length constraint of 76 characters, |
| 35 | // while the Docker compatible implementation omits the length check entirely. |
| 36 | func ValidateDockerCompat(s string) error { |
| 37 | if len(s) == 0 { |
| 38 | return fmt.Errorf("identifier must not be empty %w", errdefs.ErrInvalidArgument) |
| 39 | } |
| 40 | |
| 41 | if !AllowedIdentifierPattern.MatchString(s) { |
| 42 | return fmt.Errorf("identifier %q must match pattern %q: %w", s, AllowedIdentfierChars, errdefs.ErrInvalidArgument) |
| 43 | } |
| 44 | |
| 45 | return nil |
| 46 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…