Octal implements formatStringInterpolator.Octal.
(arg ref.Val, locale string)
| 396 | |
| 397 | // Octal implements formatStringInterpolator.Octal. |
| 398 | func (c *stringFormatter) Octal(arg ref.Val, locale string) (string, error) { |
| 399 | switch arg.Type() { |
| 400 | case types.IntType: |
| 401 | argInt := arg.Value().(int64) |
| 402 | return fmt.Sprintf("%o", argInt), nil |
| 403 | case types.UintType: |
| 404 | argInt := arg.Value().(uint64) |
| 405 | return fmt.Sprintf("%o", argInt), nil |
| 406 | default: |
| 407 | return "", octalFormatError(runtimeID, arg.Type().TypeName()) |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | // stringFormatValidator implements the cel.ASTValidator interface allowing for static validation |
| 412 | // of string.format calls. |
nothing calls this directly
no test coverage detected