You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This simple code reveals an infinite print loop (reported by i3dmaster)
package main
import "fmt"
import "log"
import "runtime/debug"
var count = 0
type foo struct {
i int
}
func (f foo) String() string {
count++
if count > 10 {
debug.PrintStack()
panic("call stack too large")
}
return fmt.Sprintf("foo@%p value: %d", f, f.i)
}
func main() {
f := foo{i: 3}
// ok
log.Println(fmt.Sprintf("foo@%p value: %d", &f, f.i))
// inf loop
log.Printf("foo@%p, value: %d\n", f, f.i)
}
r: the problem is that badVerb should not recur into the String routine.
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: