yujiachen-y / goaccessor

`goaccessor` is a Go tool designed to automate the generation of `getter` and `setter` boilerplate code for your types and variables.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run go fmt before writing to file

yasv98 opened this issue · comments

It would be good if generator.go could run go fmt on the code lines before writing to file. This would prevent having to add a go:generate go fmt _filename_.go as part of the generate commands or having the generated output fail lint checks.

I've made this change in a forked version of the repository here which could be a way to add this change. It changes the writeFile function to format the code lines before writing to a file.

@yasv98 thank you for your suggestion! I hadn't incorporated the formatting functionality because I typically format the code manually. I will address the issue soon.

Hi @yasv98 , #5 should resolve your issue.

Thanks!