Compile Time Code Weaving in Go
deferpanic.com
deferpanic.com
That's not a solution for the whole problem of making easy added/rippable changes to check specific behavior.
It leaves the code riddle with log calls and supporting code.
I currently work on Hadoop, and pretty much every project in the Hadoop ecosystem has a huge number of log statements. Most of them are turned off at any given time for performance reasons, but when it's really necessary, we can turn them on.
I can see how having a source-code patching system would avoid the overhead of having an "if" statement to check if the log message was enabled. But what are you going to do when the library changes and your patch gets out of date? Having debuggability built-in to the library, rather than available as a 3rd-party add-on, is a feature, not a bug. Hadoop also supports changing the log level at runtime, and it seems like this source code patching system does not. So while this is a very clever system and may have some specific use-cases where it's useful, I think log levels are a better way to go in most cases.
Sounds like they're implying that dependencies are bad? Coming from Node, that sounds like a painful and copypastey way to write code. Can someone explain this to me?
The DeferPanic client depends on 12 packages, all from the std lib[2].
However, there's a high likelihood of their clients using 3rd party packages, so they would see it quite often.
[1]: which seems to provide Go application stats in a friendly and discover-able way. I personally haven't used it, but it looks fairly nice. https://deferpanic.com/about
[2]: https://godoc.org/github.com/deferpanic/deferclient/defercli...
Considering the newness of the project, it seems to have good support for simple AOP use. There are a significant number of pointcuts missing when compared to AspectJ's pointcuts[5], though some are not applicable in Go.
The "after throwing" advice is inapplicable to Go[6], so can be discounted. However, "after returning" seems not to be supported yet and "around" is limited to call pointcuts.
All of this assumes that the project operates as advertised as I have no first-hand experience with this one.
1 - http://www.eclipse.org/aspectj/doc/released/progguide/index....
2 - http://www.postsharp.net/aop.net
3 - http://ruby-doc.com/docs/ProgrammingRuby/html/tut_modules.ht...
4 - http://www.artima.com/scalazine/articles/stackable_trait_pat...
5 - http://www.eclipse.org/aspectj/doc/released/progguide/semant...