Compile Time Code Weaving in Go
deferpanic.com
Compile Time Code Weaving in Go
1–10 of 11 posts
Re: Compile Time Code Weaving in Go
#2Re: Compile Time Code Weaving in Go
#3Re: Compile Time Code Weaving in Go
#4I think if you are "ripping code in/out of your app everytime you need to do something" for debugging you need to create a logging system with multiple log levels. In log4j you can turn on TRACE logging for a particular subsystem to find out more about what is going on in that system. It would help a lot if the standard Go logging package would support multiple log levels.
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.
Re: Compile Time Code Weaving in Go
#5Re: Compile Time Code Weaving in Go
#6Sounds 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?
Re: Compile Time Code Weaving in Go
#7I think if you are "ripping code in/out of your app everytime you need to do something" for debugging you need to create a logging system with multiple log levels. In log4j you can turn on TRACE logging for a particular subsystem to find out more about what is going on in that system. It would help a lot if the standard Go logging package would support multiple log levels.
> I think if you are "ripping code in/out of your app everytime you need to do something" for debugging you need to create a logging system with multiple log levels. 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.
Re: Compile Time Code Weaving in Go
#8I'm torn, because for debugging and testing, this kind of instrumentation makes me salivate, but then I think about the kinds of codebases and, worse, library packages that will be built to depend on it.
Re: Compile Time Code Weaving in Go
#9> One of the things in Go that frustrates me is packaging and it’s not because I have 20 dependencies that I’m including in each project. I don’t have a problem with that cause we don’t do that at DeferPanic. 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...