davecgh / go-spew

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow disabling address of functions

flimzy opened this issue · comments

Structs with function types output the function address, even with DisablePointerAddresses: true. Perhaps that makes sense, since a function type isn't really a pointer. But it would be great to be able to disable these addresses. To reproduce:

package main

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

func main() {
	cf := spew.ConfigState{
		DisablePointerAddresses: true,
	}
	x := struct {
		fn func()
	}{
		fn: func() {},
	}
	cf.Dump(x)
}

Which produces the following output:

(struct { fn func() }) {
fn: (func()) 0x4c0020
}

playground