In Go it is valid to create a type:
type Num int
but how can one then initialize that type? make(Num, 2) does not seem to work.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Initialize the type as you would initialize the underlying type. In your example, the underlying type is an
int. For example,The built-in function make takes a type T, which must be a slice, map or channel type.