摘要: Golang中的坑二 for ...range 最近两周用Golang做项目,编写web服务,两周时间写了大概五千行代码(业务代码加单元测试用例代码)。用Go的感觉很爽,编码效率高,运行效率也不错,用了beego,avro,xorm,反射。今天和前端联调遇到了一个bug,发现踩到了第二个坑。踩坑不怕 阅读全文
posted @ 2017-04-28 15:30 majianguo 阅读(1160) 评论(0) 推荐(0) 编辑
摘要: Cleaner, more elegant, and wrong Just because you can't see the error path doesn't mean it doesn't exist. Here's a snippet from a book on C# programmi 阅读全文
posted @ 2017-04-26 18:55 majianguo 阅读(196) 评论(0) 推荐(0) 编辑
摘要: Cleaner,more elegant,and wrong 整洁,更优雅,但是错的 并不是因为你看不到错误的产生路径就意味着它不存在。 下面是C#编程书中的一个片段,摘自关于异常处理的章节。 try { AccessDatabase accessDb = new AccessDatabase(); 阅读全文
posted @ 2017-04-26 18:55 majianguo 阅读(355) 评论(0) 推荐(0) 编辑
摘要: Cleaner, more elegant, and harder to recognize 更整洁,更优雅,但更难识别 看来,有些人把我几个月前一篇文章的标题“Cleaner,more elegant,and wrong”解释成了对异常通用处理的引用。(参见参考文献【35】,注意到电文甚至为我改变 阅读全文
posted @ 2017-04-26 18:53 majianguo 阅读(386) 评论(0) 推荐(0) 编辑
摘要: It appears that some people interpreted the title of one of my rants from many months ago, "Cleaner, more elegant, and wrong", to be a reference to ex 阅读全文
posted @ 2017-04-26 18:51 majianguo 阅读(237) 评论(0) 推荐(0) 编辑
摘要: Golang 中的坑 短变量声明 Short variable declarations 考虑如下代码: package main import ( "errors" "fmt" ) type MyObject struct { Id string Name string } func GetObj 阅读全文
posted @ 2017-04-25 16:57 majianguo 阅读(468) 评论(0) 推荐(0) 编辑
摘要: Rob pike发表过一个有名的演讲《Concurrency is not parallelism》(https://blog.golang.org/concurrency-is-not-parallelism), 演讲胶片在talks.golang.org中可以找到(https://talks.g 阅读全文
posted @ 2017-04-23 20:57 majianguo 阅读(687) 评论(0) 推荐(0) 编辑
摘要: https://github.com/golang/go/wiki/SQLDrivers SQL database drivers The database/sql and database/sql/driver packages are designed for using databases f 阅读全文
posted @ 2017-04-13 20:11 majianguo 阅读(732) 评论(0) 推荐(0) 编辑
摘要: calling c++ from golang with swig--windows dll 四 前面讲述了windows环境下golang如何通过swig调用C++ dll。由于编译c++代码使用了gcc,需要为DLL文件增加按照g++ name mangling的导出项。如果DLL导出了大量函数 阅读全文
posted @ 2017-04-09 15:18 majianguo 阅读(618) 评论(1) 推荐(0) 编辑
摘要: calling c++ from golang with swig--windows dll 三 使用动态链接库(DLL)主要有两种方式:一种通过链接导入库,在代码中直接调用DLL中的函数;另一种借助LoadLibrary/LoadLibraryEx,GetProcessAddress函数在代码中间 阅读全文
posted @ 2017-04-09 14:00 majianguo 阅读(1602) 评论(5) 推荐(0) 编辑