Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法将自定义原始类型“向下转换”回其原始原始类型?例如转换type AwesomeType byte为byte供 a 使用Writer?
type AwesomeType byte
byte
Writer
您可以简单地使用您想要的类型进行转换:
var a AwesomeType; b := byte(a)
示例:http ://play.golang.org/p/-Sj7zmz6zt