| 1 |
|
| 2 |
-- go.mod -- |
| 3 |
module example.com |
| 4 |
go 1.18 |
| 5 |
|
| 6 |
-- template/template.go -- |
| 7 |
package template |
| 8 |
|
| 9 |
import ( |
| 10 |
"fmt" |
| 11 |
"log" |
| 12 |
"os" |
| 13 |
) |
| 14 |
|
| 15 |
// Replace call to void function by call to non-void function. |
| 16 |
|
| 17 |
func before(x interface{}) { log.Fatal(x) } |
| 18 |
func after(x interface{}) { fmt.Fprintf(os.Stderr, "warning: %v", x) } |
| 19 |
|
| 20 |
-- in/e1/e1.go -- |
| 21 |
package e1 |
| 22 |
|
| 23 |
import "log" |
| 24 |
|
| 25 |
func example() { |
| 26 |
log.Fatal("oops") // match |
| 27 |
} |
| 28 |
|
| 29 |
-- out/e1/e1.go -- |
| 30 |
package e1 |
| 31 |
|
| 32 |
import ( |
| 33 |
"fmt" |
| 34 |
"log" |
| 35 |
"os" |
| 36 |
) |
| 37 |
|
| 38 |
func example() { |
| 39 |
fmt.Fprintf(os.Stderr, "warning: %v", "oops") // match |
| 40 |
} |