I've used sed to replace variables on *.go files using sed -i 's/\<old_name\>/newName/g' *.go
My objective is to eliminate golinter errors.
How can strings with common patterns, e.g. replace 1 with 2
-
fmt.Printf("blah blah blah")
orfmt.Printf("yadda yadda yadda")
-
fmt.Println("blah blah blah")
orfmt.Println("yadda yadda yadda")
In this case, we do NOT want to replace:
1. fmt.Printf("print speed= %d",speed)
//So the key here is the ending pattern should be ")
.
2. log.Printf statements //only replace "fmt."
Any pointers on this?