I am working a small refactoring tool that allows to replace values of specific struct fields in a Go repository. Modifying the AST works and the appropriate fields are replaced, but after replacing the original source file with the formatted AST, the replaced part is weirdly indented.
I wrote a minimal example that demonstrates the issue in this playground: https://go.dev/play/p/je4wZaGRZjq.
Any idea on how to fix this is appreciated since I’m was out of luck and could not find a solution to this problem.