by Jare · 12y ago · 0 comments
I suspect that there is as much trolling in people who complain about generics, as there is survivor bias in those who reply they haven't needed them in X years of go. If you felt that you needed them, you wouldn't have lasted long using go!
> you can code for a very long time without hitting your first interface{}
Negroni, a popular and self-appointedly idiomatic library: https://github.com/codegangsta/negroni/blob/master/negroni_t...
func expect(t *testing.T, a interface{}, b interface{})
func refute(t *testing.T, a interface{}, b interface{})
Ok, that's just for testing - it's not unusual to have to go off path to be able to test your code. How about Google's own standardized idiom for production code? https://blog.golang.org/context Value(key interface{}) interface{}
Or Go's own standard library? http://golang.org/pkg/encoding/json/ func Marshal(v interface{}) ([]byte, error)
func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error)
func Unmarshal(data []byte, v interface{}) error
No, it does not take such a long time.