MCPcopy Create free account
hub / github.com/cel-expr/cel-go / formatLiteral

Function formatLiteral

common/debug/debug.go:255–274  ·  view source on GitHub ↗
(c ref.Val)

Source from the content-addressed store, hash-verified

253}
254
255func formatLiteral(c ref.Val) string {
256 switch v := c.(type) {
257 case types.Bool:
258 return fmt.Sprintf("%t", v)
259 case types.Bytes:
260 return fmt.Sprintf("b%s", strconv.Quote(string(v)))
261 case types.Double:
262 return fmt.Sprintf("%v", float64(v))
263 case types.Int:
264 return fmt.Sprintf("%d", int64(v))
265 case types.String:
266 return strconv.Quote(string(v))
267 case types.Uint:
268 return fmt.Sprintf("%du", uint64(v))
269 case types.Null:
270 return "null"
271 default:
272 panic("Unknown constant type")
273 }
274}
275
276func (w *debugWriter) append(s string) {
277 w.doIndent()

Callers 1

BufferMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected