mailgun / godebug

DEPRECATED! https://github.com/derekparker/delve
Apache License 2.0
2.5k stars 107 forks source link

undefined: godebug.EnteringNewScope #56

Closed glycerine closed 9 years ago

glycerine commented 9 years ago

e57fb7e2aae9c6aa79ad007957f2ca32fc7b74fa

Hi @jeremyschlatter, having some trouble trying the latest godebug. go1.4.2. centos6.6/amd64. Please advise. Thanks!

Jason

$ go run me.go
usage: 
exit status 1
$ 

# yes. minified example runs as expected. now try under godebug:

$ godebug run me.go
# command-line-arguments
/tmp/godebug572895385/me.go:9: undefined: godebug.EnteringNewScope
$ cat me.go
package main

import (
    "fmt"
    "os"
)

func usage() {
    fmt.Fprintf(os.Stderr, "usage: \n")
    os.Exit(1)
}

func main() {
    if len(os.Args) < 4 {
        usage()
    }
    a := os.Args[1]
    b := os.Args[2]
    c := os.Args[3]

    fmt.Fprintf(os.Stderr, "me! %v %v %v\n", a, b, c)

}
$

again with -godebugwork and the start of the output shown

$ godebug run -godebugwork me.go
/tmp/godebug438483676
# command-line-arguments
/tmp/godebug438483676/me.go:9: undefined: godebug.EnteringNewScope

$ cat /tmp/godebug438483676/me.go
package main

import (
    "fmt"
    "github.com/mailgun/godebug/lib"
    "os"
)

var me_go_scope = godebug.EnteringNewScope(me_go_contents)

func usage() {
    ctx, ok := godebug.EnterFunc(usage)
    if !ok {
        return
    }
    defer godebug.ExitFunc(ctx)
    godebug.Line(ctx, me_go_scope, 9)
    fmt.Fprintf(os.Stderr, "usage: \n")
    godebug.Line(ctx, me_go_scope, 10)
    os.Exit(1)
}

func main() {
    ctx, ok := godebug.EnterFunc(main)
    if !ok {
        return
...
glycerine commented 9 years ago

So odd. This reproduced a couple of times, then just now it started working(!) Closing because I can't repro any longer.

jeremyschlatter commented 9 years ago

Strange. Here's a guess: godebug.EnteringNewScope was recently renamed to godebug.EnteringNewFile. If you updated the code in your directory by running "git pull" but didn't run "go install github.com/mailgun/godebug", then you would have been using an older code-generating binary that outputted godebug.EnteringNewScope calls, and they would fail to link against the new library that only had godebug.EnteringNewFile calls.

Could that be the case?

glycerine commented 9 years ago

Ah. Good to know. Was probably using an out of date binary.