I want to replace some function from standard Go library (os.Exit
specifically). Can I do that? I tried:
myExitValue := reflect.ValueOf(func() {
fmt.Println("exiting")
})
reflect.ValueOf(os.Exit).Set(myExitValue)
But it panics: reflect: reflect.Value.Set using unaddressable value