Open griesemer opened 10 years ago
This just bit me trying to use "gofmt -r" while working on issue #10055:
- case ld.R_PLT0: // add ip, pc, #0xXX00000
+ case obj.R_PLT0:
Another test case. I was refactoring an example and the replacement happened on the line just before the // Output:
comment, causing the entire output comment block to be removed.
$ cat p_test.go
package main
import (
"bytes"
"fmt"
)
func ExampleFoo() {
var a bytes.Buffer
fmt.Fprintf(&a, "a123")
fmt.Println(string(a.Bytes()))
// Output:
// a123
}
$ gofmt -d -r 'string(b.Bytes()) -> b.String()' p_test.go
diff -u p_test.go.orig p_test.go
--- p_test.go.orig 2018-02-17 09:52:32.000000000 -0800
+++ p_test.go 2018-02-17 09:52:32.000000000 -0800
@@ -8,8 +8,6 @@
func ExampleFoo() {
var a bytes.Buffer
fmt.Fprintf(&a, "a123")
- fmt.Println(string(a.Bytes()))
+ fmt.Println(a.String())
- // Output:
- // a123
}
Another test case:
package main
// comment
And another test case, taken from my gobco project:
package main
//go:generate go run build/gen.go
Reproducible with go1.14 bf3ee57d27f7542808f8a153c7b547efaba355b0 from today.