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

Function FormatResolvedValue

pkg/importinpututil/import_input.go:42–54  ·  view source on GitHub ↗

FormatResolvedValue formats a resolved import input value for textual substitution. []any/map[string]any and typed slices/maps are normalized and JSON-marshaled, nil returns ("", false), and scalars use fmt.Sprintf("%v", v).

(value any)

Source from the content-addressed store, hash-verified

40// substitution. []any/map[string]any and typed slices/maps are normalized and
41// JSON-marshaled, nil returns ("", false), and scalars use fmt.Sprintf("%v", v).
42func FormatResolvedValue(value any) (string, bool) {
43 switch v := value.(type) {
44 case []any:
45 return marshalValue(v)
46 case map[string]any:
47 return marshalValue(v)
48 case nil:
49 importInputLog.Print("FormatResolvedValue: nil value, no substitution")
50 return "", false
51 default:
52 return formatReflectiveValue(v)
53 }
54}
55
56func formatReflectiveValue(value any) (string, bool) {
57 rv := reflect.ValueOf(value)

Calls 3

marshalValueFunction · 0.85
formatReflectiveValueFunction · 0.85
PrintMethod · 0.80