pingcap / failpoint

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

failpoint can be actived if it is injected with in a function clusure #71

Closed glorv closed 2 years ago

glorv commented 2 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. demo code:

    f := func(g func() error) {}
    f(func() error {
    failpoint.Inject("with-in-a-clusure", func() {
    failpoint.Return(errors.New("mock err"))
    })
    return nil
    })

    exec failpoint-ctl enable, the failpoint.Inject remains unchanged.

  2. What did you expect to see?

  3. What did you see instead?

  4. Versions of the failpoint

glorv commented 2 years ago

duplicated with #70