Skip to content

EasyConceptStructs, interfaces and generics

How do you define a method on a struct?

What a good answer covers

Declare a function with a receiver: func (u User) Name() string. Use a pointer receiver when the method must modify the struct or the struct is large.

More on Structs, interfaces and generics

Flashcards for this topic