go的类型别名 不能和他本来的类型相加,报错 invalid operation: a + b (mismatched types bigint and int64)
点击查看代码
package main
import "fmt"
func main() {
// 比如int64,我想改成bigint
type bigint int64
var a bigint
a = 10
fmt.Println(a)
fmt.Printf("%T\n",a) // main.bigint main包.bigint
/* //类型别名不能和他本来的类型相加,报错 invalid operation: a + b (mismatched types bigint and int64)
var b int =77
c :=a +b
fmt.Printf("%T\n",c) // main.bigint main包.bigint
fmt.Printf("%d\n",c) // main.bigint main包.bigint */
}
写入自己的博客中才能记得长久