golang-cheat-sheet icon indicating copy to clipboard operation
golang-cheat-sheet copied to clipboard

All non-built in types can have methods

Open drawks opened this issue 9 years ago • 1 comments

https://github.com/basti1302/go-lang-cheat-sheet/blame/master/README.markdown#L345 and https://github.com/basti1302/go-lang-cheat-sheet/blame/master/README.markdown#L361-L363

Seem to imply that functions can only be assigned to structs, however all user defined types can have methods. There is nothing unique about structs with regard to method/function declaration.

see example: https://play.golang.org/p/DPFZz0mCbi

drawks avatar Mar 13 '15 21:03 drawks

Care to provide a pull request?

basti1302 avatar Mar 15 '15 20:03 basti1302