2020年12月23日星期三

Custom string types in Go

How can I create a custom type in Go that is restricted to a certain list of string values? e.g.

type Suit = "Spade" | "Diamond" | "Club" | "Heart"  
https://stackoverflow.com/questions/65433238/custom-string-types-in-go December 24, 2020 at 10:25AM

没有评论:

发表评论