IMO a groups of constraints are horrible with interfaces
type CommonResponse(type E) interface {
GetError() E
}
type CommonError interface {
GetCode() int32
}
func IsOK(type R CommonResponse(E), E CommonError)(r R) bool {
switch r.GetError().GetCode() {
case 0, 200, 201:
return true
default:
return false
}
}
vs
constract CommmonResponse(R, E) {
R GetError() E
E GetCode() int32
}
func IsOK(type R, E CommonResponse)(r R) bool {
switch r.GetError().GetCode() {
case 0, 200, 201:
return true
default:
return false
}
}
That trickery with commas to express dependcy of types is hard
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/4e25a228-4c96-44ba-b33a-bbde3460ea2ao%40googlegroups.com.