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

spew fails to detect cyclic data

cpcallen opened this issue · comments

The following runs forever(*) without producing any output:

package main

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

func main() {
	type loop *loop
	var loop1, loop2 loop
	loop1 = &loop2
	loop2 = &loop1
	spew.Dump(&loop1)
}

(*) It does not hit the stack size limit; its memory usage does keep growing so obviously it will eventually run out of swap or virtual address space...

#53 is possibly related.

I was going to say there was no interface values involved here, but of course the param to Dump is itself of interface type. So yes: entirely possible that this is related.