Grokking Advanced Go
Vote

0% completed

​

Generic Types and Aliases

A generic type is a type declaration with a type parameter list, so one declaration describes many related types. Each of those types has its own type argument, and Page[Order] and Page[Item] are two different types with one definition. The order service needs this for a page of a listing, which has the same fields whatever it contains.

A generic type has rules of its own, because it can have methods and its name almost always needs a type argument

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content