Skip to content

Commit b626fee

Browse files
committed
Update README.md
1 parent d449b02 commit b626fee

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,89 @@ html := godump.DumpHTML(user)
9595
}
9696
```
9797

98+
## 📘 How to Read the Output
99+
100+
`godump` output is designed for clarity and traceability. Here's how to interpret its structure:
101+
102+
### 🧭 Location Header
103+
104+
```text
105+
<#dump // main.go:26
106+
````
107+
108+
* The first line shows the **file and line number** where `godump.Dump()` was invoked.
109+
* Helpful for finding where the dump happened during debugging.
110+
111+
---
112+
113+
### 🔎 Type Names
114+
115+
```text
116+
#main.User
117+
```
118+
119+
* Fully qualified struct name with its package path.
120+
121+
---
122+
123+
### 🔐 Visibility Markers
124+
125+
```text
126+
+Name => "Alice"
127+
-secret => "..."
128+
```
129+
130+
* `+` → Exported (public) field
131+
* `-` → Unexported (private) field (accessed reflectively)
132+
133+
---
134+
135+
### 🔄 Cyclic References
136+
137+
If a pointer has already been printed:
138+
139+
```text
140+
↩︎ &1
141+
```
142+
143+
* Prevents infinite loops in circular structures
144+
* References point back to earlier object instances
145+
146+
---
147+
148+
### 🔢 Slices and Maps
149+
150+
```text
151+
0 => "value"
152+
a => 1
153+
```
154+
155+
* Array/slice indices and map keys are shown with `=>` formatting and indentation
156+
* Slices and maps are truncated if `maxItems` is exceeded
157+
158+
---
159+
160+
### 🔣 Escaped Characters
161+
162+
```text
163+
"Line1\nLine2\tDone"
164+
```
165+
166+
* Control characters like `\n`, `\t`, `\r`, etc. are safely escaped
167+
* Strings are truncated after `maxStringLen` runes
168+
169+
---
170+
171+
### 🧩 Supported Types
172+
173+
* ✅ Structs (exported & unexported)
174+
* ✅ Pointers, interfaces
175+
* ✅ Maps, slices, arrays
176+
* ✅ Channels, functions
177+
* ✅ time.Time (nicely formatted)
178+
179+
```
180+
98181
## 🧩 License
99182
100183
MIT © [goforj](https://github.com/goforj)

0 commit comments

Comments
 (0)