Implements a deep pretty printer for Go data structures to aid in debugging

go-spew

Build Status ISC License Coverage Status

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

GoDoc

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:

spew.Dump(myVar1, myVar2, ...)
spew.Fdump(someWriter, myVar1, myVar2, ...)
str := spew.Sdump(myVar1, myVar2, ...)

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):

spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2)
spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2)
spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)

Debugging a Web Application Example

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.

package main

import (
    "fmt"
    "html"
    "net/http"

    "github.com/davecgh/go-spew/spew"
)

func handler(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-Type", "text/html")
    fmt.Fprintf(w, "Hi there, %s!", r.URL.Path[1:])
    fmt.Fprintf(w, "<!--\n" + html.EscapeString(spew.Sdump(w)) + "\n-->")
}

func main() {
    http.HandleFunc("/", handler)
    http.ListenAndServe(":8080", nil)
}

Sample Dump Output

(main.Foo) {
 unexportedField: (*main.Bar)(0xf84002e210)({
  flag: (main.Flag) flagTwo,
  data: (uintptr) <nil>
 }),
 ExportedField: (map[interface {}]interface {}) {
  (string) "one": (bool) true
 }
}
([]uint8) {
 00000000  11 12 13 14 15 16 17 18  19 1a 1b 1c 1d 1e 1f 20  |............... |
 00000010  21 22 23 24 25 26 27 28  29 2a 2b 2c 2d 2e 2f 30  |!"#$%&'()*+,-./0|
 00000020  31 32                                             |12|
}

Sample Formatter Output

Double pointer to a uint8:

	  %v: <**>5
	 %+v: <**>(0xf8400420d0->0xf8400420c8)5
	 %#v: (**uint8)5
	%#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5

Pointer to circular struct with a uint8 field and a pointer to itself:

	  %v: <*>{1 <*><shown>}
	 %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)<shown>}
	 %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)<shown>}
	%#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)<shown>}

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 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.

Comments
  • Google App Engine

    Google App Engine

    Is it possible to remove the unsafe package so that your package works with Google App Engine:

    parser: bad import "unsafe" in github.com/davecgh/go-spew/spew/common.go

  • Feature Request: Support printing in Go syntax

    Feature Request: Support printing in Go syntax

    Right now spew does a great job of visualizing Go data structures for debugging purposes. I think it'd be useful to be able to print the data structures that is valid Go code to recreate the structure itself.

    For instance, currently this code...

    package main
    
    import "github.com/davecgh/go-spew/spew"
    
    func main() {
        spew.Config.Indent = "\t"
    
        type Inner struct {
            Field1 string
            Field2 int
        }
        type Lang struct {
            Name  string
            Year  int
            URL   string
            Inner *Inner
        }
    
        x := Lang{
            Name: "Go",
            Year: 2009,
            URL:  "http",
            Inner: &Inner{
                Field1: "Secret!",
            },
        }
    
        spew.Dump(x)
    }
    

    Will produce:

    (main.Lang) {
        Name: (string) "Go",
        Year: (int) 2009,
        URL: (string) "http",
        Inner: (*main.Inner)(0x42166440)({
            Field1: (string) "Secret!",
            Field2: (int) 0
        })
    }
    

    But I'd like to be able to print x so that the output would be:

    Lang{
        Name: "Go",
        Year: 2009,
        URL:  "http",
        Inner: &Inner{
            Field1: "Secret!",
        },
    }
    

    And/or:

    Lang{Name: "Go", Year: 2009, URL: "http", Inner: &Inner{Field1: "Secret!"}}
    
  • fatal error: stack overflow

    fatal error: stack overflow

    I used a Delve debugger and go version go1.6.2 darwin/amd64. When tried to log token's struct I got this message

    (*oauth2.token)(0xc82006cea0)(
    runtime: goroutine stack exceeds 1000000000-byte limit
    fatal error: stack overflow
    

    whereas using another method fmt.Printf I get the following

    &oauth2.token{Token:oauth2.Token{AccessToken:"(redacted)", TokenType:"", RefreshToken:"", Expiry:time.Time{sec:0, nsec:0, loc:(*time.Location)(0x8ccd80)}, raw:interface {}(nil)}}
    

    Setting the MaxDepth limit doesn't work.

  • simpler, more robust bypass

    simpler, more robust bypass

    We make the bypass implementation a little simpler by inferring the flag field position from available reflect information and more robust by checking that the flags that are set actually match the semantics we expect.

    We can restrict the use of unsafe to a single function: flagField.

  • Does not spew any struct fields for me:

    Does not spew any struct fields for me:

    I have a type like this:

    type FrustumCoords struct {
        Vec2
        C, TL, TR, BL, BR Vec3
    
        x, y Vec3
    }
    

    Whether I spew.Printf or spew.Dump a variable of that type, it only spews the fields of the embedded Vec2 (which in turn has two float64 fields, X and Y), nothing else, no C, TL, TR, BL, BR..

    What now? Docs say:

    * MaxDepth
        Maximum number of levels to descend into nested data structures.
        There is no limit by default.
    

    OK I'm not setting any configs for spew anywhere, so not sure what I have to do?

  • handle map[*A]B better

    handle map[*A]B better

    I have a map[*MyStruct]OtherThing. Even with SortKeys set to true, the map ordering is non-deterministic (pointers, duh). I wonder if we could do something more heavyweight but deterministic when *MyStruct does not have a String() method? Maybe a new config option like SpewKeys which would apply the same spew conversion to each map key, then sort the resulting strings.

    I understand it's a pretty niche case, but it would be useful in our generic "hash object" logic.

    Alternatively, some way to get an error for a non-deterministic spew?

  • Stringer : runtime: goroutine stack exceeds 1000000000-byte limit

    Stringer : runtime: goroutine stack exceeds 1000000000-byte limit

    Hello, I want to use go-spew into String() string. For example:

    type Example struct {
        foo string
    }
    
    func (e Example) String() string {
      return spew.Sprintf("%+v", e)
    }
    

    Unfortunately, that generates:

    runtime: goroutine stack exceeds 1000000000-byte limit
    fatal error: stack overflow
    
    runtime stack:
    runtime.throw(0x55c280, 0xe)
        /usr/lib/go/src/runtime/panic.go:547 +0x90
    runtime.newstack()
        /usr/lib/go/src/runtime/stack.go:940 +0xb11
    runtime.morestack()
        /usr/lib/go/src/runtime/asm_amd64.s:359 +0x7f
    
    goroutine 1 [stack growth]:
    fmt.(*pp).argNumber(0xc826df4820, 0x0, 0x553da0, 0x3, 0x2, 0x1, 0x0, 0x0, 0x0)
        /usr/lib/go/src/fmt/print.go:1088 fp=0xc8401002b8 sp=0xc8401002b0
    fmt.(*pp).doPrintf(0xc826df4820, 0x553da0, 0x3, 0xc826dbf530, 0x1, 0x1)
        /usr/lib/go/src/fmt/print.go:1144 +0xc87 fp=0xc840100640 sp=0xc8401002b8
    fmt.Sprintf(0x553da0, 0x3, 0xc826dbf530, 0x1, 0x1, 0x0, 0x0)
        /usr/lib/go/src/fmt/print.go:203 +0x6f fp=0xc840100690 sp=0xc840100640
    github.com/davecgh/go-spew/spew.Sprintf(0x553da0, 0x3, 0xc840100730, 0x1, 0x1, 0x0, 0x0)
        .../github.com/davecgh/go-spew/spew/spew.go:126 +0x90 fp=0xc8401006e8 sp=0xc840100690
    main.Person.String(0x26, 0x5544e0, 0x6, 0x554540, 0x7, 0xc82000e0c0, 0x3, 0x3, 0x0, 0x0)
        .../src/cmd/spew/main.go:17 
    

    Do you know a elegant manner to do this ?

    Thx

  • Bug with go 1.4.1

    Bug with go 1.4.1

    Hi! I used go-spew in long running process and had this error:

    fatal error: unexpected signal during runtime execution
    [signal 0xb code=0x1 addr=0x1 pc=0x8069ef0]
    
    runtime stack:
    runtime.gothrow(0x8416f68, 0x2a)
            /usr/local/go/src/runtime/panic.go:503 +0x67 fp=0xb63e2f4c sp=0xb63e2f40
    runtime.sigpanic()
            /usr/local/go/src/runtime/sigpanic_unix.go:14 +0x53 fp=0xb63e2f74 sp=0xb63e2f4c
    scanblock(0x189c89e8, 0x10, 0x8438b68)
            /usr/local/go/src/runtime/mgc0.c:311 +0x840 fp=0xb63e3014 sp=0xb63e2f74
    scanframe(0xb63e30a0, 0x0, 0x1)
            /usr/local/go/src/runtime/mgc0.c:740 +0x186 fp=0xb63e3050 sp=0xb63e3014
    runtime.gentraceback(0x80520d0, 0x189c89e4, 0x0, 0x1887adc0, 0x0, 0x0, 0x7fffffff, 0xb63e30f8, 0x0, 0x0, ...)
            /usr/local/go/src/runtime/traceback.go:311 +0x5c5 fp=0xb63e30cc sp=0xb63e3050
    scanstack(0x1887adc0)
            /usr/local/go/src/runtime/mgc0.c:777 +0x1e0 fp=0xb63e3104 sp=0xb63e30cc
    markroot(0x1870a050, 0xc4)
            /usr/local/go/src/runtime/mgc0.c:553 +0xcd fp=0xb63e313c sp=0xb63e3104
    runtime.parfordo(0x1870a050)
            /usr/local/go/src/runtime/parfor.c:76 +0x99 fp=0xb63e3198 sp=0xb63e313c
    gc(0xb63e32d4)
            /usr/local/go/src/runtime/mgc0.c:1439 +0x1fb fp=0xb63e32c4 sp=0xb63e3198
    runtime.gc_m()
            /usr/local/go/src/runtime/mgc0.c:1368 +0xd2 fp=0xb63e32e4 sp=0xb63e32c4
    runtime.onM(0x18710000)
            /usr/local/go/src/runtime/asm_386.s:266 +0x50 fp=0xb63e32e8 sp=0xb63e32e4
    runtime.mstart()
            /usr/local/go/src/runtime/proc.c:818 fp=0xb63e32ec sp=0xb63e32e8
    
    
    goroutine 6662130 [garbage collection]:
    runtime.switchtoM()
            /usr/local/go/src/runtime/asm_386.s:208 fp=0x1881eae8 sp=0x1881eae4
    runtime.gogc(0x0)
            /usr/local/go/src/runtime/malloc.go:469 +0x1aa fp=0x1881eb08 sp=0x1881eae8
    runtime.mallocgc(0x10, 0x0, 0x3, 0x0)
            /usr/local/go/src/runtime/malloc.go:341 +0x2c4 fp=0x1881eb60 sp=0x1881eb08
    runtime.rawmem(0x8, 0x8)
            /usr/local/go/src/runtime/malloc.go:371 +0x38 fp=0x1881eb74 sp=0x1881eb60
    runtime.growslice(0x82e40e0, 0x1881ebd8, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0)
            /usr/local/go/src/runtime/slice.go:83 +0x210 fp=0x1881ebb4 sp=0x1881eb74
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr(0x18878b80, 0x8379ec0, 0x1882f400, 0x36)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:107 +0x65b fp=0x1881ec6c sp=0x1881ebb4
    github.com/davecgh/go-spew/spew.(*dumpState).dump(0x18878b80, 0x8379ec0, 0x1882f400, 0x36)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:259 +0xdf fp=0x1881edc4 sp=0x1881ec6c
    github.com/davecgh/go-spew/spew.(*dumpState).dump(0x18878b80, 0x82ec860, 0x18737494, 0xf5)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:382 +0xdbd fp=0x1881ef1c sp=0x1881edc4
    github.com/davecgh/go-spew/spew.(*dumpState).dump(0x18878b80, 0x837c9a0, 0x18737480, 0xf9)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:412 +0x13e2 fp=0x1881f074 sp=0x1881ef1c
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr(0x18878b80, 0x8379ec0, 0x18737480, 0x36)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:154 +0x593 fp=0x1881f12c sp=0x1881f074
    github.com/davecgh/go-spew/spew.(*dumpState).dump(0x18878b80, 0x8379ec0, 0x18737480, 0x36)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:259 +0xdf fp=0x1881f284 sp=0x1881f12c
    github.com/davecgh/go-spew/spew.(*dumpState).dump(0x18878b80, 0x837c9a0, 0x188536e0, 0xf9)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:412 +0x13e2 fp=0x1881f3dc sp=0x1881f284
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr(0x18878b80, 0x8379ec0, 0x188536e0, 0x36)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:154 +0x593 fp=0x1881f494 sp=0x1881f3dc
    github.com/davecgh/go-spew/spew.(*dumpState).dump(0x18878b80, 0x8379ec0, 0x188536e0, 0x36)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:259 +0xdf fp=0x1881f5ec sp=0x1881f494
    github.com/davecgh/go-spew/spew.(*dumpState).dump(0x18878b80, 0x837e2a0, 0x1882b560, 0xd9)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:412 +0x13e2 fp=0x1881f744 sp=0x1881f5ec
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr(0x18878b80, 0x838bc80, 0x1882b560, 0x16)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:154 +0x593 fp=0x1881f7fc sp=0x1881f744
    github.com/davecgh/go-spew/spew.(*dumpState).dump(0x18878b80, 0x838bc80, 0x1882b560, 0x16)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:259 +0xdf fp=0x1881f954 sp=0x1881f7fc
    github.com/davecgh/go-spew/spew.(*dumpState).dump(0x18878b80, 0x837f2a0, 0x18853700, 0xd9)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:412 +0x13e2 fp=0x1881faac sp=0x1881f954
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr(0x18878b80, 0x837fda0, 0x18853700, 0x16)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:154 +0x593 fp=0x1881fb64 sp=0x1881faac
    github.com/davecgh/go-spew/spew.(*dumpState).dump(0x18878b80, 0x837fda0, 0x18853700, 0x16)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:259 +0xdf fp=0x1881fcbc sp=0x1881fb64
    github.com/davecgh/go-spew/spew.fdump(0x8570060, 0xb75b8470, 0x1882aae0, 0x1881fdbc, 0x1, 0x1)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:456 +0x22c fp=0x1881fd34 sp=0x1881fcbc
    github.com/davecgh/go-spew/spew.Sdump(0x1881fdbc, 0x1, 0x1, 0x0, 0x0)
            /gopath/src/github.com/davecgh/go-spew/spew/dump.go:471 +0x8e fp=0x1881fd74 sp=0x1881fd34
    
  • Dump without showing pointer addresses

    Dump without showing pointer addresses

    Hi,

    I'd like to use spew in combination with a text diff pkg to show useful error messages when deep equality checks fail in my test cases. Ideally I'd like to have the same output as Dump(), but without the pointer addresses showing. Would you be interested in a patch for this? I'd be happy to propose an API for it first or take a suggestion from you.

    Cheers, Felix

  • Displaying len and cap

    Displaying len and cap

    It would handy if types that had len and cap were spewed with their length and capacity.

    I propose the following output, which keeps the type separate from the length and possibly cap as well:

    For slices:

    ([]string) (len=2 cap=10) {
     (string) "Hello",
     (string) "世界"
    }
    

    Maps:

    (map[string]bool) (len=2) {
     (string) "Hello": (bool) true,
     (string) "世界": (bool) false
    }
    

    Strings:

    (string) (len=13) "Hello, 世界"
    

    Channels:

    (chan string) (len=2 cap=10) 0xc20804e600
    

    Although the len and cap functions are defined for arrays, spewing their results is less useful as both are equal to the array size regardless. Displaying it anyways may be desirable for consistancy, however.

  • Add support for limited mode without unsafe pkg.

    Add support for limited mode without unsafe pkg.

    This pull request adds support for compiling spew without the unsafe package. When compiled without the unsafe package, some of the more advanced features such as invoking stringers on pointers from non-pointer variables and unexported struct fields are not available.

    By default, spew will be compiled in the limited mode for Google App Engine since the unsafe package is not available there. Additionally, spew can be compiled without the unsafe package manually by specifying the disableunsafe build tag.

    Finally, a new package-level constant named UnsafeDisabled has been exposed which can be used to programmatically determine if spew was compiled with access to the unsafe package.

  • Override String function not works with anonymous struct param

    Override String function not works with anonymous struct param

    example code

    func main() {
    	a := A{
    		Tag: "tag-A",
    		Num: 1,
    		InA: InA{
    			Id:   100,
    			Type: "test",
    		},
    	}
    	spew.Dump(a)
    }
    
    type A struct {
    	Tag string
    	Num int
    	InA
    }
    
    type InA struct {
    	Id   int
    	Type string
    }
    
    func (t InA) String() string {
    	return t.Type
    }
    

    unexpected output

    (main.A) test
    
  • Custom `String()` method of maps got invalid receiver value

    Custom `String()` method of maps got invalid receiver value

    Repro:

    package main
    
    import (
    	"fmt"
    
    	"github.com/davecgh/go-spew/spew"
    )
    
    type X map[int]int
    
    func (x X) String() string {
    	return fmt.Sprintf("{M1:%d}", len(x))
    }
    
    func main() {
    	spew.Dump(X{1: 2})
    }
    

    Output:

    (main.X) (len=1) (PANIC=runtime error: invalid memory address or nil pointer dereference){
     (int) 1: (int) 2
    }
    

    Panic occures when taking the len() of the receiver x, which is an invalid pointer.

    This happens on all versions of go I installed (1.16 to 1.18).

  • Support option to avoid printing duplicate values

    Support option to avoid printing duplicate values

    Currently if there are multiple references to a pointer, the entire contents of it are printed each time (unless it's a recursive reference).

    This can result in unnecessarily large and hard to read output when an object is shared in many places.

    In one recent example, the output was 28MB, but when I changed the code to avoid printing duplicates (by removing the delete(d.pointers, k) line), the output dropped to 280KB, a factor of 100x difference.

    This is not necessarily something that would be a good idea to enable by default, because it would require using O(n) memory to keep track of all pointers seen so far, but ISTM that it would be nice to be able to enable de-duplication as an option, at any rate.

  • github.com/davecgh/go-spew/spew is not a main package

    github.com/davecgh/go-spew/spew is not a main package

    go install github.com/davecgh/go-spew/spew@latest package github.com/davecgh/go-spew/spew is not a main package

    how can i handle with this? i'm totally new to linux Ubuntu. My go version is go version go1.18.2 linux/amd64

  • Slice index out of range panic

    Slice index out of range panic

    I'm calling Sdump on a complex struct and it seems to go out of bounds on a slice:

    runtime.gopanic
    	/opt/go/src/runtime/panic.go:965
    reflect.Value.Index
    	/opt/go/src/reflect/value.go:962
    github.com/davecgh/go-spew/spew.(*dumpState).dumpSlice
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:238
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:352
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:394
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:391
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dumpSlice
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:238
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:352
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dumpSlice
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:238
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:352
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:421
    github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:154
    github.com/davecgh/go-spew/spew.(*dumpState).dump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:262
    github.com/davecgh/go-spew/spew.fdump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:465
    github.com/davecgh/go-spew/spew.Sdump
    	/code/.cache/gopath/pkg/mod/github.com/davecgh/[email protected]/spew/dump.go:480
    

    Here's the code block in value that it's hitting:

    	case Slice:
    		// Element flag same as Elem of Ptr.
    		// Addressable, indirect, possibly read-only.
    		s := (*unsafeheader.Slice)(v.ptr)
    		if uint(i) >= uint(s.Len) {
    			panic("reflect: slice index out of range")
    		}
    

    This was in prod so I'm not sure what the exact input was, but let me know if there's anything else that would be relevant.

    Thanks!

Litter is a pretty printer library for Go data structures to aid in debugging and testing.

Litter Litter is a pretty printer library for Go data structures to aid in debugging and testing. Litter is provided by Sanity: The Headless CMS Const

Dec 28, 2022
Colored pretty printer for Go language
Colored pretty printer for Go language

pp Colored pretty printer for Go language Usage Just call pp.Print(). import "github.com/k0kubun/pp" m := map[string]string{"foo": "bar", "hello": "w

Dec 29, 2022
Quick and dirty debugging output for tired Go programmers
Quick and dirty debugging output for tired Go programmers

q q is a better way to do print statement debugging. Type q.Q instead of fmt.Printf and your variables will be printed like this: Why is this better t

Jan 7, 2023
A simple to use log system, minimalist but with features for debugging and differentiation of messages
A simple to use log system, minimalist but with features for debugging and differentiation of messages

A simple to use log system, minimalist but with features for debugging and differentiation of messages

Sep 26, 2022
Package httpretty prints the HTTP requests you make with Go pretty on your terminal.

httpretty Package httpretty prints the HTTP requests of your Go programs pretty on your terminal screen. It is mostly inspired in curl's --verbose mod

Jan 8, 2023
🪵 A dead simple, pretty, and feature-rich logger for golang
🪵 A dead simple, pretty, and feature-rich logger for golang

?? lumber ?? A dead simple, pretty, and feature-rich logger for golang ?? Install ?? Logging Functions lumber.Success() lumber.Info() lumber.Debug() l

Jul 20, 2022
A customized GORM logger that implements the appropriate interface and uses Logrus to output logs

CryptoMath GORM Logger A customized GORM logger that implements the appropriate interface and uses Logrus to output logs. Install go get github.com/ma

Nov 6, 2021
Package logging implements a logging infrastructure for Go
Package logging implements a logging infrastructure for Go

Golang logging library Package logging implements a logging infrastructure for Go. Its output format is customizable and supports different logging ba

Nov 10, 2021
A flexible process data collection, metrics, monitoring, instrumentation, and tracing client library for Go
A flexible process data collection, metrics, monitoring, instrumentation, and tracing client library for Go

Package monkit is a flexible code instrumenting and data collection library. See documentation at https://godoc.org/gopkg.in/spacemonkeygo/monkit.v3 S

Dec 14, 2022
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.

The open-source platform for monitoring and observability. Grafana allows you to query, visualize, alert on and understand your metrics no matter wher

Jan 3, 2023
Open source framework for processing, monitoring, and alerting on time series data

Kapacitor Open source framework for processing, monitoring, and alerting on time series data Installation Kapacitor has two binaries: kapacitor – a CL

Dec 26, 2022
Golang beautify data display for Humans

Golang beautify data display for Humans English 简体中文 Usage Examples package main import ( ffmt "gopkg.in/ffmt.v1" ) func main() { example() } typ

Dec 22, 2022
pprof is a tool for visualization and analysis of profiling data

Introduction pprof is a tool for visualization and analysis of profiling data. pprof reads a collection of profiling samples in profile.proto format a

Jan 8, 2023
Very simple charts with some debug data for Go programs
Very simple charts with some debug data for Go programs

debugcharts Go memory debug charts. This package uses Plotly chart library. It is open source and free for use. Installation go get -v -u github.com/m

Dec 14, 2022
Visualise Go program GC trace data in real time

This project is no longer maintained I'm sorry but I do not have the bandwidth to maintain this tool. Please do not send issues or PRs. Thank you. gcv

Dec 14, 2022
Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content.
Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content.

Noodlog Summary Noodlog is a Golang JSON parametrized and highly configurable logging library. It allows you to: print go structs as JSON messages; pr

Oct 27, 2022
Interfaces for LZ77-based data compression

Pack Interfaces for LZ77-based data compression. Introduction Many compression libraries have two main parts: Something that looks for repeated sequen

Oct 19, 2021
mtail - extract internal monitoring data from application logs for collection into a timeseries database
 mtail - extract internal monitoring data from application logs for collection into a timeseries database

mtail - extract internal monitoring data from application logs for collection into a timeseries database mtail is a tool for extracting metrics from a

Dec 29, 2022
Go Huobi Market Price Data Monitor
Go Huobi Market Price Data Monitor

火币(Huobi)价格监控 由于部分交易对火币官方未提供价格监控,因此写了个小程序,长期屯币党可以用它来提醒各种现货价格。 该工具只需要提前安装Go环境和Redis即可。 消息推送使用的「钉钉」,需要提前配置好钉钉机器人(企业群类型、带webhook的机器人)。 使用方法 下载本项目 拷贝根目录下

Oct 13, 2022