cannot use &total (type *uint64) as type *int64 in argument to atomic.AddInt64

cannot use &total (type uint64) as type int64 in argument to atomic.AddInt64
意思就是无法将total变量(类型为
uint64)用作的参数中的类型
int64原子AddInt64。改正过来也很简单。将atomic.AddInt64改为atomic.AddUint64。因为total定义时为uint64,而这里将它传给了atomic.AddInt64函数(是int64类型)作为参数,因此出错。
下面说一下go语言中int64和uint64的区别:
int64 带符号64位整数,8字节
uint64 无符号64位整数,8字节

猜你喜欢

转载自blog.csdn.net/qq_45701131/article/details/113136604