猴子补丁 发表于 2020-04-17 所谓猴子补丁就是在程序运行的过程中动态的修改一些模块、类、方法,而不是在静态代码中去修改相应的实现 1234567891011121314151617181920package mainimport ( "fmt" "os" "strings" "bou.ke/monkey")func main() { monkey.Patch(fmt.Println, func(a ...interface{}) (n int, err error) { s := make([]interface{}, len(a)) for i, v := range a { s[i] = strings.Replace(fmt.Sprint(v), "hell", "*bleep*", -1) } return fmt.Fprintln(os.Stdout, s...) }) fmt.Println("what the hell?") // what the *bleep*?} golang monkeyhttp://xiaorui.cc/archives/5128https://studygolang.com/articles/11296