Given a Go project I write for my company I have (and want) to:
* write comments on functions/methods (at least the exported ones)
* write few information to be stored in the logs or in the emitted events: function name, purpose (why the function was called), output obtained (~event result from calling the function/method), expected input and possible outputs types and status codes
A lot of information is shared and it would be very nice to avoid copy and past is over and over spreading it through the code.
It would be great to have those information bounded in some way to the function/method but I'm open to better ways of thinking.
A struct with the information with a method returning the function seems wrong to me
Can you suggest a way to reduce duplication and approach this matter in a good way?
Good to me means clean, clear to the reader, idiomatic, generic = not bound to a single web framework, play well with custom CI/CD and, most important, not insanely complicated and involuted like the standard swagger comments.
Thanks a lot
Brunetto