nil

Posted by 夏泽民

You need to loop over each of the elements in the slice and test. Equality for slices is not defined. However, there is a bytes.Equal function if you are comparing values of type []byte.



lock chan

Posted by 夏泽民

chan用于high-level (高端的编程,比如说,两个程序(运行在同一台电脑,或者不同电脑上),或者两个线程(thread)之间的sync), 而锁用于low-level(低端编程,单个变量的sync). 如果把线程安全定义为允许多个goroutine同时去读写,那么golang 的channel 是线程安全的。不需要在并发读写同一个channe时加锁。 channel用于goroutine之间的通信



apcu

Posted by 夏泽民

APCu 是老牌 PHP 字节码和对象缓存 缓存器 APC 的分支,具体由来还得讲个故事。



timer

Posted by 夏泽民

https://segmentfault.com/a/1190000022646776 Go语言的标准库里提供两种类型的计时器Timer和Ticker。Timer经过指定的duration时间后被触发,往自己的时间channel发送当前时间,此后Timer不再计时。Ticker则是每隔duration时间都会把当前时间点发送给自己的时间channel,利用计时器的时间channel可以实现很多与计时相关的功能。



semgrep

Posted by 夏泽民

https://mp.weixin.qq.com/s/tJm0d1ZW3_9PViK3S8xgrw https://github.com/returntocorp/semgrep



Search

Popular posts

Anything in here will be replaced on browsers that support the canvas element

Recent posts

This blog is maintained by 夏泽民

Get in touch with me at 465474307@qq.com

Subscribe to our mailing list

* indicates required