![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
golang
ant-one
一个懒惰的程序员
展开
-
golang实现try-catch-finally机制
面向对象的编程语言往往都会支持语言级别的异常处理,比如c++使用关键字try开始异常语句块, catch捕获异常,throw抛出异常: try { throw 1; throw std::logic_error("user defined exception"); } catch (int e) { std::clog std::endl; } catch (const原创 2018-01-30 23:19:40 · 4822 阅读 · 2 评论 -
golang的空标识符理解
我们有时候看到这样的golang代码: import _ "net/http/pprof" 或 for _, c := range "11234" { log.Println(c) } 或 var _ io.Reader = (* XXX)(nil) //全局变量 或 var _ = Suite(&HelloWorldTest{}) 代码中_很独特的样子:说...原创 2018-02-04 19:51:59 · 1048 阅读 · 0 评论