MCPcopy Create free account
hub / github.com/github/gh-aw / formatNumericKind

Function formatNumericKind

pkg/console/render.go:538–549  ·  view source on GitHub ↗

formatNumericKind formats numeric kinds without Interface() as a fallback.

(val reflect.Value)

Source from the content-addressed store, hash-verified

536
537// formatNumericKind formats numeric kinds without Interface() as a fallback.
538func formatNumericKind(val reflect.Value) string {
539 switch val.Kind() {
540 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
541 return strconv.FormatInt(val.Int(), 10)
542 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
543 return strconv.FormatUint(val.Uint(), 10)
544 case reflect.Float32, reflect.Float64:
545 return fmt.Sprintf("%f", val.Float())
546 default:
547 return val.Type().String()
548 }
549}
550
551// formatFieldValueWithTag formats a reflect.Value as a string for display with format tag support
552func formatFieldValueWithTag(val reflect.Value, tag consoleTag) string {

Callers 1

formatFieldValueFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected