Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

gofmt -w -r 'interface{} -> any' src

Is this a real command? If so, I’m very impressed. Is there any equivalent for c++ and other languages?



Yep, it's a rewrite rule: https://pkg.go.dev/cmd/gofmt

The combination of unambiguous syntax and consistently-formatted code results in rewrites producing meaningful diffs (most of the time).


'cargo fix' will upgrade your code from one Rust edition to the next as well as apply corrections for lint warnings.


cargo fix is closer to (and possibly inspired by?) go fix[1], imo.

[1]: https://pkg.go.dev/cmd/go#hdr-Update_packages_to_use_new_API...


IntelliJ, Resharper, and presumably Rider have structural search and replace[0]. It's available for at least C#, Java, and Kotlin.

[0] https://www.jetbrains.com/help/idea/structural-search-and-re...





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: