最近发布的主题
暂无
最近发布的文章
暂无
最近分享的资源
暂无
最近发布的项目
暂无
最近的评论
-
评论了博文 golang踩坑---批量生成随机数重复问题// Unix returns t as a Unix time, the number of seconds elapsed // since January 1, 1970 UTC. The result does not depend on the // location associated with t. // Unix-like operating systems often record time as a 32-bit // count of seconds, but since the method here returns a 64-bit // value it is valid for billions of years into the past or future. func (t Time) Unix() int64 { return t.unixSec() } // UnixNano returns t as a Unix time, the number of nanoseconds elapsed // since January 1, 1970 UTC. The result is undefined if the Unix time // in nanoseconds cannot be represented by an int64 (a date before the year // 1678 or after 2262). Note that this means the result of calling UnixNano // on the zero Time is undefined. The result does not depend on the // location associated with t. func (t Time) UnixNano() int64 { return (t.unixSec())*1e9 + int64(t.nsec()) } 写代码前就不能看看文档吗?Unix是秒级的,UnixNano才是纳秒。。。
-
评论了主题 有段代码看不懂,求大佬解答```go package main import "fmt" type foo int func (f foo) Print() { fmt.Println(f) } func main() { fn := foo.Print fn(5) foo.Print(6) } ``` 方法又怎样。。怎样也没问题。接收器实际上就是第一个参数
-
评论了主题 关于切片的一个问题[a:b] ab的取值范围是0>=a>=b>=len() a=len()似乎没什么意义,但是有时可以简化代码逻辑
-
写得太具体了。。后面一堆破事都没耐心看完。
-
评论了主题 关于go协程使用chan的疑惑并行天然就是乱序的,想顺序必须同步,同步包(sync)了解一下。