diff options
| author | Dave Collins <[email protected]> | 2013-01-12 12:06:59 -0600 |
|---|---|---|
| committer | Dave Collins <[email protected]> | 2013-01-12 12:06:59 -0600 |
| commit | 034a2a5a5e92d7264ec7558d20f4d7746506ee8f (patch) | |
| tree | 01c534af8c7b813318a2066d7befc04666a32d75 /spew/doc.go | |
| parent | 40eb25a95da22b84740d793f4279c212a865fdee (diff) | |
Implement support for unqiue config instances.
This commit adds a new type, SpewState, which can be used to create
instances with unique configuration options. The methods of SpewState are
equivalent to the top-level functions. Full documentation and examples
are included.
Diffstat (limited to 'spew/doc.go')
| -rw-r--r-- | spew/doc.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spew/doc.go b/spew/doc.go index 61c0091..94db62d 100644 --- a/spew/doc.go +++ b/spew/doc.go @@ -58,20 +58,29 @@ printing style, use the convenience wrappers Printf, Fprintf, etc with either Configuration Options +Configuration of spew is handled by fields in the ConfigState type. For +convenience, all of the top-level functions use a global state available +via the spew.Config global. + +It is also possible to create a SpewState instance which provides a unique +ConfigState accessible via the Config method. The methods of SpewState are +equivalent to the top-level functions. This allows concurrent configuration +options. See the SpewState documentation for more details. + The following configuration options are available: - spew.Config.MaxDepth + * MaxDepth Maximum number of levels to descend into nested data structures. There is no limit by default. - spew.Config.Indent + * Indent String to use for each indentation level for Dump functions. It is a single space by default. A popular alternative is "\t". - spew.Config.DisableMethods + * DisableMethods Disables invocation of error and Stringer interface methods. Method invocation is enabled by default. - spew.Config.DisablePointerMethods + * DisablePointerMethods Disables invocation of error and Stringer interface methods on types which only accept pointer receivers from non-pointer variables. Pointer method invocation is enabled by default. |
