gg
gg copied to clipboard
support no-name function result
Hi, here is the request for supporting no-name function result. Sometimes setup result names for a tiny function is unnecessary. E.g. 👇🏼
func GetName() (ignoreTheName string) {
return name
}
Thank you for the suggestion. However, I haven't been writing in Golang for some time now. Would you be willing to submit a pull request for this?
Thank you for the suggestion. However, I haven't been writing in Golang for some time now. Would you be willing to submit a pull request for this?
Sure I'm willing to support the new feature. However I need to be familiar with the code before I can change it 😂. Now using fmt.Fprintf to directly produce those tiny functions is still a good alternative for me. Maybe next time I can help to build the feature lol
I just found @Xuanwo your code already support the feature! 😂I've added 4 test cases in #15 .
BTW, I was plan to use gg to generate code in my project https://github.com/yujiachen-y/goaccessor . However I found the generated code still need to be gofmt by myself 🤔, so I don't use gg for now.
However I found the generated code still need to be
gofmtby myself , so I don't use gg for now.
Yes, gg only output the correctly AST and the format should be done by users. Maybe we can add format support before writing.