Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

badVerb should not recur #2555

Closed
robpike opened this issue Dec 12, 2011 · 2 comments
Closed

badVerb should not recur #2555

robpike opened this issue Dec 12, 2011 · 2 comments
Milestone

Comments

@robpike
Copy link
Contributor

robpike commented Dec 12, 2011

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.
@rsc
Copy link
Contributor

rsc commented Dec 12, 2011

Comment 1:

Labels changed: added priority-go1, removed priority-medium.

@robpike
Copy link
Contributor Author

robpike commented Dec 15, 2011

Comment 2:

This issue was closed by revision 24e9683.

Status changed to Fixed.

@robpike robpike self-assigned this Dec 15, 2011
@rsc rsc added this to the Go1 milestone Apr 10, 2015
@rsc rsc removed the priority-go1 label Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned robpike Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants