diff options
| author | Dave Collins <[email protected]> | 2013-02-03 01:33:35 -0600 |
|---|---|---|
| committer | Dave Collins <[email protected]> | 2013-02-03 01:35:24 -0600 |
| commit | 52f41f689fbb82dfa8650d4e7caf85a69cdc7483 (patch) | |
| tree | a5fef93aa377553535839f9c457239b49804cf50 /spew | |
| parent | e183fe2f19be2ac0a74bd6d2eb0c47d4aa7a9561 (diff) | |
Rename pad function to indent.
The name indent better describes the function. This also will help
differentiate the function from planned functions that are intended to
perform padding for the purposes of aligning fields, types, and values.
Diffstat (limited to 'spew')
| -rw-r--r-- | spew/common_test.go | 2 | ||||
| -rw-r--r-- | spew/dump.go | 42 |
2 files changed, 22 insertions, 22 deletions
diff --git a/spew/common_test.go b/spew/common_test.go index 0f1715d..e999660 100644 --- a/spew/common_test.go +++ b/spew/common_test.go @@ -39,7 +39,7 @@ func (s *pstringer) String() string { } // xref1 and xref2 are cross referencing structs for testing circular reference -// detection. +// detection. type xref1 struct { ps2 *xref2 } diff --git a/spew/dump.go b/spew/dump.go index 057c299..57572c6 100644 --- a/spew/dump.go +++ b/spew/dump.go @@ -27,19 +27,19 @@ import ( // dumpState contains information about the state of a dump operation. type dumpState struct { - w io.Writer - depth int - pointers map[uintptr]int - ignoreNextType bool - ignoreNextPad bool - cs *ConfigState + w io.Writer + depth int + pointers map[uintptr]int + ignoreNextType bool + ignoreNextIndent bool + cs *ConfigState } -// pad performs indentation according to the depth level and cs.Indent +// indent performs indentation according to the depth level and cs.Indent // option. -func (d *dumpState) pad() { - if d.ignoreNextPad { - d.ignoreNextPad = false +func (d *dumpState) indent() { + if d.ignoreNextIndent { + d.ignoreNextIndent = false return } d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth)) @@ -148,14 +148,14 @@ func (d *dumpState) dump(v reflect.Value) { // Handle pointers specially. if kind == reflect.Ptr { - d.pad() + d.indent() d.dumpPtr(v) return } // Print type information unless already handled elsewhere. if !d.ignoreNextType { - d.pad() + d.indent() d.w.Write(openParenBytes) d.w.Write([]byte(v.Type().String())) d.w.Write(closeParenBytes) @@ -203,7 +203,7 @@ func (d *dumpState) dump(v reflect.Value) { d.w.Write(openBraceNewlineBytes) d.depth++ if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.pad() + d.indent() d.w.Write(maxNewlineBytes) } else { numEntries := v.Len() @@ -217,7 +217,7 @@ func (d *dumpState) dump(v reflect.Value) { } } d.depth-- - d.pad() + d.indent() d.w.Write(closeBraceBytes) case reflect.String: @@ -234,7 +234,7 @@ func (d *dumpState) dump(v reflect.Value) { d.w.Write(openBraceNewlineBytes) d.depth++ if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.pad() + d.indent() d.w.Write(maxNewlineBytes) } else { numEntries := v.Len() @@ -242,7 +242,7 @@ func (d *dumpState) dump(v reflect.Value) { for i, key := range keys { d.dump(d.unpackValue(key)) d.w.Write(colonSpaceBytes) - d.ignoreNextPad = true + d.ignoreNextIndent = true d.dump(d.unpackValue(v.MapIndex(key))) if i < (numEntries - 1) { d.w.Write(commaNewlineBytes) @@ -252,24 +252,24 @@ func (d *dumpState) dump(v reflect.Value) { } } d.depth-- - d.pad() + d.indent() d.w.Write(closeBraceBytes) case reflect.Struct: d.w.Write(openBraceNewlineBytes) d.depth++ if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.pad() + d.indent() d.w.Write(maxNewlineBytes) } else { vt := v.Type() numFields := v.NumField() for i := 0; i < numFields; i++ { - d.pad() + d.indent() vtf := vt.Field(i) d.w.Write([]byte(vtf.Name)) d.w.Write(colonSpaceBytes) - d.ignoreNextPad = true + d.ignoreNextIndent = true d.dump(d.unpackValue(v.Field(i))) if i < (numFields - 1) { d.w.Write(commaNewlineBytes) @@ -279,7 +279,7 @@ func (d *dumpState) dump(v reflect.Value) { } } d.depth-- - d.pad() + d.indent() d.w.Write(closeBraceBytes) case reflect.Uintptr: |
