pingcap / failpoint

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

failpoint can not use a constant-string as marker function name #35

Closed spongedu closed 4 years ago

spongedu 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. failpoint fail to rewrite the following circumstance:
    
    package main

import (

"github.com/pingcap/failpoint"

) const ( Marker = "failpoint-name" ) func F1(name string) string {

failpoint.Inject(Marker, nil)

return "hello " + name

}


2. What did you expect to see?
This file can be correctly rewritten by `failpoint-ctl` tool

3. What did you see instead?
rewrite failed.
```sh
/bin/sh: Rewrite: command not found
make: *** [failpoint-enable] Error 127
  1. Versions of the failpoint

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

ReleaseVersion bf45ab2 BuildTS 2019-05-15 09:48:44 GitHash bf45ab20bfc48d624b61944a4820768c16d7db99 GitBranch master GoVersion go version go1.12 darwin/amd64

spongedu commented 5 years ago

@lonng as we've discussed. Open an issue to track this.

lonng commented 5 years ago

Thanks for your report.

amyangfei commented 4 years ago

fixed in https://github.com/pingcap/failpoint/pull/46

spongedu commented 4 years ago

Wow! Great! thanks @amyangfei @hanfei1991