Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
fmt: stack overflow with recursive slice input and formatters %v/%#v #8241
What does 'go version' print? go version go1.3 linux/amd64 What steps reproduce the problem? Passing a slice that contains itself to a fmt.* function with either an implicit or explicit %v formatter will result in an infinite recursion. http://play.golang.org/p/qjG87yG_LA What happened? Infinite recursion inside the printing logic, stack limit reached. What could have happened instead? 1. The documentation for fmt mentions this recursion caveat, being obvious it could happen this is just for clarification. 2. The fmt functions need to keep track of what it has printed and not try to print recursive values. 3. The fmt functions keep track of what it prints and panics (or error) with a more sensible message when it detects recursion.