diff --git a/code/failpoint.go b/code/failpoint.go index 9476a78..9028203 100644 --- a/code/failpoint.go +++ b/code/failpoint.go @@ -69,8 +69,8 @@ func (fp *Failpoint) hdr(varname string) string { } func (fp *Failpoint) footer() string { - return "; __badType" + fp.name + ": " + - fp.Runtime() + ".BadType(v" + fp.name + ", \"" + fp.varType + "\"); };" + return "; goto __nomock" + fp.name + "; __badType" + fp.name + ": " + + fp.Runtime() + ".BadType(v" + fp.name + ", \"" + fp.varType + "\"); __nomock" + fp.name + ": };" } func (fp *Failpoint) flushSingle(dst io.Writer) error { diff --git a/code/rewrite.go b/code/rewrite.go index 9ab0ce3..fcf53cf 100644 --- a/code/rewrite.go +++ b/code/rewrite.go @@ -98,7 +98,7 @@ func ToComments(wdst io.Writer, rsrc io.Reader) ([]*Failpoint, error) { unmatchedBraces += opening - closing if unmatchedBraces == 0 { // strip off badType footer - lTrim = strings.Split(lTrim, "; __badType")[0] + lTrim = strings.Split(lTrim, "; goto __nomock")[0] } s := ws + "//" + wsPrefix(l, ws)[1:] + lTrim + "\n" dst.WriteString(s) @@ -114,7 +114,7 @@ func ToComments(wdst io.Writer, rsrc io.Reader) ([]*Failpoint, error) { n := strings.Split(strings.Split(l, "__fp_")[1], ".")[0] t := strings.Split(strings.Split(l, ".(")[1], ")")[0] dst.WriteString(ws + pfx + " var " + n + " " + t + "\n") - if !strings.Contains(l, "; __badType") { + if !strings.Contains(l, "; goto __nomock") { // not single liner unmatchedBraces = 1 }