I'm experimenting the gofmt
tool capabilities for refactoring go code based on this blog post, I have this trivial example:
package main
import (
"fmt"
)
var v = 12
func main() {
fmt.Println(v)
}
I'm trying to rename the v
variable to m
applying this recipe:
gofmt -r 'v -> m' -w main.go
The code after the refactoring looks (broken) like:
package m
import (
"fmt"
)
var m = m
func m() {
m
}
What am I missing here?