suggestions about reusing function information in comments, swagger, ...

30 views
Skip to first unread message

brunetto

unread,
Sep 18, 2017, 3:42:19 PM9/18/17
to golang-nuts
Hi all!!
I apologize if someone is seeing this mail twice but it seems I didn't send it the first time.

For some (web) Go projects I'm developing in my company is required to write few information about functions (and methods)

* comments (at lest for the exported functions)
* information required to create API docs with swagger (through a personal project wrapping github.com/MarkSonghurst/swag/swagger: name, route, input, output, description, ...
* information to be stored in log and emitted events: function name, purpose of the call (~command), result of the call (~event), input and output, ...

A large amount of such information is duplicated.

I am looking for a way to reduce information duplication, that is, I write all the information once and in one place and it is (re)used where it is needed. 
It's ok to use go generate if necessary. 

Do you have any experience, ideas or suggestions on how to do this in a good way?
Good to me means clean and clear, idiomatic, easy to understand, easy to automate in a CI/CD pipeline.

Thank a lot, 

brunetto
Reply all
Reply to author
Forward
0 new messages