davecgh/go-spew is a open-source project on GitHub, written primarily in Go. It has 6.4k stars. Implements a deep pretty printer for Go data structures to aid in debugging
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Go-spew implements a deep pretty printer for Go data structures to aid in
debugging. A comprehensive suite of tests with 100% test coverage is provided
to ensure proper functionality. See test_coverage.txt for the gocov coverage
report. Go-spew is licensed under the liberal ISC license, so it may be used in
open source or commercial projects.
If you're interested in reading about how this package came to life and some
of the challenges involved in providing a deep pretty printer, there is a blog
post about it
here.
Documentation
Full go doc style documentation for the project can be viewed online without
installing this package by using the excellent GoDoc site here:
http://godoc.org/github.com/davecgh/go-spew/spew
You can also view the documentation locally once the package is installed with
the godoc tool by running godoc -http=":6060" and pointing your browser to
http://localhost:6060/pkg/github.com/davecgh/go-spew/spew
Installation
$ go get -u github.com/davecgh/go-spew/spew
Quick Start
Add this import line to the file you're working in:
import "github.com/davecgh/go-spew/spew"
To dump a variable with full newlines, indentation, type, and pointer
information use Dump, Fdump, or Sdump:
Alternatively, if you would prefer to use format strings with a compacted inline
printing style, use the convenience wrappers Printf, Fprintf, etc with %v (most
compact), %+v (adds pointer addresses), %#v (adds types), or %#+v (adds types
and pointer addresses):
Here is an example of how you can use spew.Sdump() to help debug a web application. Please be sure to wrap your output using the html.EscapeString() function for safety reasons. You should also only use this debugging technique in a development environment, never in production.
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 ConfigState instance that provides methods
equivalent to the top-level functions. This allows concurrent configuration
options. See the ConfigState documentation for more details.
* Indent
String to use for each indentation level for Dump functions.
It is a single space by default. A popular alternative is "\t".
* MaxDepth
Maximum number of levels to descend into nested data structures.
There is no limit by default.
* DisableMethods
Disables invocation of error and Stringer interface methods.
Method invocation is enabled by default.
* DisablePointerMethods
Disables invocation of error and Stringer interface methods on types
which only accept pointer receivers from non-pointer variables. This option
relies on access to the unsafe package, so it will not have any effect when
running in environments without access to the unsafe package such as Google
App Engine or with the "safe" build tag specified.
Pointer method invocation is enabled by default.
* DisablePointerAddresses
DisablePointerAddresses specifies whether to disable the printing of
pointer addresses. This is useful when diffing data structures in tests.
* DisableCapacities
DisableCapacities specifies whether to disable the printing of capacities
for arrays, slices, maps and channels. This is useful when diffing data
structures in tests.
* ContinueOnMethod
Enables recursion into types after invoking error and Stringer interface
methods. Recursion after method invocation is disabled by default.
* SortKeys
Specifies map keys should be sorted before being printed. Use
this to have a more deterministic, diffable output. Note that
only native types (bool, int, uint, floats, uintptr and string)
and types which implement error or Stringer interfaces are supported,
with other types sorted according to the reflect.Value.String() output
which guarantees display stability. Natural map order is used by
default.
* SpewKeys
SpewKeys specifies that, as a last resort attempt, map keys should be
spewed to strings and sorted by those strings. This is only considered
if SortKeys is true.
Unsafe Package Dependency
This package relies on the unsafe package to perform some of the more advanced
features, however it also supports a "limited" mode which allows it to work in
environments where the unsafe package is not available. By default, it will
operate in this mode on Google App Engine and when compiled with GopherJS. The
"safe" build tag may also be specified to force the package to build without
using the unsafe package.
License
Go-spew is licensed under the copyfree ISC License.
No homepage URL was recorded for davecgh/go-spew in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Does davecgh/go-spew have any tags?
TopGit's last sync did not record any GitHub topics for davecgh/go-spew. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on davecgh/go-spew?
The most recent commit recorded on davecgh/go-spew was 2.6 years ago, based on the GitHub push timestamp. The repository has 378 forks — one of the better signals of community interest.
How many stars does davecgh/go-spew have?
davecgh/go-spew has 6.4k GitHub stars — refresh the page for the live number, or check github.com/davecgh/go-spew. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What language is davecgh/go-spew written in?
davecgh/go-spew is written primarily in Go. GitHub's language field is based on the largest share of bytes in the default branch.
What license does davecgh/go-spew use?
davecgh/go-spew is released under the ISC license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where do I read more about davecgh/go-spew?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/davecgh/go-spew is the definitive source.
Read full README in the tab above.
Curious whether go-spew is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about go-spew.