How to replace an external Go dependency with a local copy

The Problem You’re using a great open source library in your project, and then, one day, you find yourself thinking: “Oh, wouldn’t be great if the author just added a tiny little log statement in that function?”. Yeah, it really would, this would allow me to trace the value of that variable or try a small change. What can you do: fork the library? Nope. Don’t do that. Replace it! You can temporarily replace the original module with a local copy, changing one line in your go....

February 5, 2021 · 2 min · 220 words · Maurizio Branca