Skip to content

Instantly share code, notes, and snippets.

View srfrog's full-sized avatar
🇵🇷
Boricua

Señor Gus srfrog

🇵🇷
Boricua
View GitHub Profile
@srfrog
srfrog / gist:dd47071d401810a37e5d
Created July 30, 2014 08:19
find if a method is defined within an struct saved as interface{}
v := reflect.ValueOf(self.collection)
if m := v.MethodByName("Create"); m.IsValid() {
handler := m.Interface().(func(ResponseWriter, *Request))
self.Route("POST", "", handler)
}