摘要: 一、了解一些概念 Golang的log包短小精悍,可以非常轻松的实现日志打印转存功能。不用多说,log支持并发操作(即协程安全-相对于JAVA中的线程安全而言),其结构定义如下: type Logger struct { mu sync.Mutex // ensures atomic writes; 阅读全文
posted @ 2021-10-01 23:23 踏雪无痕SS 阅读(1211) 评论(0) 推荐(0) 编辑
摘要: time包提供了时间的显示和测量用的函数。日历的计算采用的是公历。 time 类型 type Time struct { // wall and ext encode the wall time seconds, wall time nanoseconds, // and optional mono 阅读全文
posted @ 2021-10-01 11:34 踏雪无痕SS 阅读(7248) 评论(0) 推荐(0) 编辑
摘要: 众所周知,Go语言是严格类型语言,而开发的时候又遇到传入参数不定的情况,怎么办? 这里的三个点(…),就给我们编程人员带来很大的灵活性,具体如下 在Golang中,三个点一共会用在四个地方(话说三个点的官方说法是什么?): 代码如下: package main import ( "fmt" "log 阅读全文
posted @ 2021-10-01 11:19 踏雪无痕SS 阅读(979) 评论(1) 推荐(0) 编辑