|
|
|
|
|
by ansible
4241 days ago
|
|
(Incidentally, though I moved past my then really poor understanding of Go interfaces, I wasn't able to apply the respondent's answer or my new general knowledge to achieve the abstraction I was looking for, and settled for just grinding out the same code for the dozen entities/endpoints it applied to.) I definitely can't deny that using interfaces instead of regular OO classes takes some getting used to. Though I don't understand why you had to grind out duplicate code for all the entities / endpoints though. I hacked up things a bit to get it to run on the playground, but as Jesse McNelis wrote, just passing the pointer to foo worked for the code you wrote. http://play.golang.org/p/jNpK5CRBfv |
|
[1]http://golang.org/doc/effective_go.html#mixed-caps