How to override func of an existing go package?

go

Solution

You simply cannot do this. There is no "best way" to do something impossible.

All you have are alternatives:

- Fork log4go and patch it.

- Do not use `log4go.Error` but your own wrapper `myError` which wraps around log4go's Error function.

- Redesign or look for a different logging package.

Problem

I am new to go and cannot really put my head around it. I want to override a func in an existing package in go "log4go" on every log4go.Error("An error") call. What is the best way to do it? If I want to enhance an existing method, what else could be the way? Please bear if its a basic question.

Original source