I wanted to see what would happen if a certain packet wasn’t sent. However, after I modified the library and run the program nothing changed. Even when I deleted everything from a library source file nothing changed.
Is it possible to make it rebuild everything so my changes have effect?
Rather than changing the original library, you could try copying the code to a custom http library and making the changes there. Then change your import paths to your custom http lib and you should be able to get the modified behavior.
Disclaimer: This is only a spontaneous idea, I never tried this myself.
As long as you implement the same interface methods, you can substitute your own code for any standard library object. You don’t even need to copy the entire original library in question, as long as you can swoop in at the right moment and make sure your object is used instead of the stdlib one.
For example, I wrote an
http.FileServer replacement. It supports the same methods, so through the magic of interface substitution I can use it with
http.ListenAndServe and all the rest of the standard http library, without needing to change the rest of the library.
Since you mention packets, are you trying to do HTTP/2 interop testing? If so, did you notice
GODEBUG=http2debug=2 and the other HTTP/2 debug logging options?
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.