Hi,
I'm trying to rewrite one of my clis from Python to Go. I found
https://github.com/spf13/cobra that looks like the simplest library to do it.
The cli that I write have few cross-cutting concerns, like logging all commands execution with current environment data (OS, hostname ...). In my Python code I use decorators to wrap specific code with additional behaviour.
I'm new to Go and I thought I can try to do the same with cobra embedding its Command struct in my ExtendedStruct overridding/wrap its Execute function. I ended with this
https://play.golang.org/p/u7ZhIM0TImHow would you attach additional behaviour to functions like this in Go and don't duplicate cross-cutting concerns code?
Thanks.