pingcap / failpoint

An implementation of failpoints for Golang.
Apache License 2.0
817 stars 63 forks source link

failpoint in anonymous function can not be enable #43

Closed lysu closed 5 years ago

lysu commented 5 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a recipe for reproducing the error.
package testpkg

import (
    "fmt"

    "github.com/pingcap/failpoint"
)

func test() {
    func() {
        failpoint.Inject("testPoint", func() {
            fmt.Println()
        })
    }()
}

then failpoint-ctl enable~

  1. What did you expect to see?
func test() {
    func() {
        if _, ok := failpoint.Eval(_curpkg_("testPoint")); ok {
            fmt.Println()
        }
    }()
}
  1. What did you see instead?
func test() {
    func() {
        failpoint.Inject("testPoint", func() {
            fmt.Println()
        })
    }()
}
  1. Versions of the failpoint

failpoint-ctl version (run failpoint-ctl -V):

ReleaseVersion None
BuildTS None
GitHash None
GitBranch None
GoVersion None

newest tidb master