You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While refactoring some code written a bit too C-stylish with constants in uppercase I by mistake renamed a constant named SWITCH to switch. This particular operation was successful but the next rename failed.
I remember reading that gorename should take a well-typed program and either return an error or another well-typed program as its output. But in this case it broke the code for me by my own stupidity.
Would it be possible to have gorename check for reserved keywords before applying the requested changes?
package main
func main() {
SWITCH := "X"
_ = SWITCH
}
Renaming the variable SWITCH to lowercase and then trying to rename it to something else.
$ gorename -from 'main.go::SWITCH' -to switch
Renamed 2 occurrences in 1 file in 1 package.
$ gorename -from 'main.go::switch' -to toggleSwitch
/Users/matseng/gocode/src/github.com/smallroomlabs/bug1/main.go:4:9: expected operand, found ':=' (and 2 more errors)
gorename: couldn't load packages due to errors: github.com/smallroomlabs/bug1
The text was updated successfully, but these errors were encountered:
While refactoring some code written a bit too C-stylish with constants in uppercase I by mistake renamed a constant named SWITCH to switch. This particular operation was successful but the next rename failed.
I remember reading that gorename should take a well-typed program and either return an error or another well-typed program as its output. But in this case it broke the code for me by my own stupidity.
Would it be possible to have gorename check for reserved keywords before applying the requested changes?
Renaming the variable SWITCH to lowercase and then trying to rename it to something else.
The text was updated successfully, but these errors were encountered: