MCPcopy Index your code
hub / github.com/golang/example / parseLogEntries

Function parseLogEntries

slog-handler-guide/indenthandler4/indent_handler_test.go:59–71  ·  view source on GitHub ↗

!+parseLogEntries

(t *testing.T, data []byte)

Source from the content-addressed store, hash-verified

57
58// !+parseLogEntries
59func parseLogEntries(t *testing.T, data []byte) []map[string]any {
60 entries := bytes.Split(data, []byte("---\n"))
61 entries = entries[:len(entries)-1] // last one is empty
62 var ms []map[string]any
63 for _, e := range entries {
64 var m map[string]any
65 if err := yaml.Unmarshal([]byte(e), &m); err != nil {
66 t.Fatal(err)
67 }
68 ms = append(ms, m)
69 }
70 return ms
71}
72
73// !-parseLogEntries
74

Callers 2

TestSlogtestFunction · 0.70
TestParseLogEntriesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…