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

Function formatReflectiveValue

pkg/importinpututil/import_input.go:56–66  ·  view source on GitHub ↗
(value any)

Source from the content-addressed store, hash-verified

54}
55
56func formatReflectiveValue(value any) (string, bool) {
57 rv := reflect.ValueOf(value)
58 switch rv.Kind() {
59 case reflect.Slice:
60 return marshalValue(normalizeSlice(rv))
61 case reflect.Map:
62 return marshalValue(normalizeMap(rv))
63 default:
64 return fmt.Sprintf("%v", value), true
65 }
66}
67
68func marshalValue(value any) (string, bool) {
69 b, err := json.Marshal(value)

Callers 1

FormatResolvedValueFunction · 0.85

Calls 3

marshalValueFunction · 0.85
normalizeSliceFunction · 0.85
normalizeMapFunction · 0.85

Tested by

no test coverage detected