Closed stevenroose closed 6 years ago
I've had this issue since always in one of my projects. The newlines and indentations get lost when using spew on a certain object type. All other object both before and after dumping this one, are printed just fine.
This is the type definition and all the subtypes. It can be found in the wild here: https://github.com/ethereum/go-ethereum/blob/master/core/types/receipt.go#L46
type Receipt struct { PostState []byte Status uint CumulativeGasUsed *big.Int Bloom Bloom Logs []*Log TxHash common.Hash ContractAddress common.Address GasUsed *big.Int } type Hash [HashLength]byte type Address [AddressLength]byte type Bloom [BloomByteLength]byte type Log struct { Address common.Address Topics []common.Hash Data []byte BlockNumber uint64 TxHash common.Hash TxIndex uint BlockHash common.Hash Index uint Removed bool }
It looks like some of the values are breaking for formatting.
Here's an example:
(spew.ConfigState) { Indent: (string) (len=1) " ", MaxDepth: (int) 0, DisableMethods: (bool) false, DisablePointerMethods: (bool) false, DisablePointerAddresses: (bool) false, DisableCapacities: (bool) false, ContinueOnMethod: (bool) false, SortKeys: (bool) false, SpewKeys: (bool) false } (*types.Receipt)(0xc420001c80)(receipt{status=0 cgas=3500000 bloom=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[]}) (spew.ConfigState) { Indent: (string) (len=1) " ", MaxDepth: (int) 0, DisableMethods: (bool) false, DisablePointerMethods: (bool) false, DisablePointerAddresses: (bool) false, DisableCapacities: (bool) false, ContinueOnMethod: (bool) false, SortKeys: (bool) false, SpewKeys: (bool) false }
Whoops, just remember that I had this issue a year ago and that it was the String() method that looks a lot like spew output.
String()
I've had this issue since always in one of my projects. The newlines and indentations get lost when using spew on a certain object type. All other object both before and after dumping this one, are printed just fine.
This is the type definition and all the subtypes. It can be found in the wild here: https://github.com/ethereum/go-ethereum/blob/master/core/types/receipt.go#L46
It looks like some of the values are breaking for formatting.
Here's an example: