摘要:
今天试着按照上一篇博客的设计自己实现自己的crawler, 踩了一路坑。有些找到了答案,有些没有。我先将这些坑记录下来,然后divide and conquer。code snippet 1 package util 2 3 import ( 4 "math" 5 "sync" 6... 阅读全文
摘要:
最近看了《Go并发编程实战》,学了最后一章的crawler。这是一个很好的demo, 设计功能完备,同时具有可扩展性。根据学到的思路简单总结一下,同时重复发明一下轮子。Version 01:比如:我们想爬一下一个外贸网站所有的 商品。其中,有三个component,(1) Downloader, 用... 阅读全文
摘要:
1. router in golang1). sample code 1 package main 2 3 import ( 4 "fmt" 5 "net/http" 6 ) 7 8 func main() { 9 10 http.HandleFunc("/handlef... 阅读全文
摘要:
1. environment for gowe don't need to set GOROOT, seehttp://dave.cheney.net/2013/06/14/you-dont-need-to-set-goroot-reallyJust add the following lines ... 阅读全文
摘要:
断断续续理了一下关于channel的一些概念,现在可以把下面的程序理清楚了。1. source code这个程序来自于《Go语言程序设计》 7.2.2 并发的Grep, 程序如下。package mainimport ( "bufio" "bytes" "fmt" "io" ... 阅读全文
摘要:
I spent several hours to figure out some conceptions about channel tonight1. buffered channel and non-buffered channelbuffered channelbufferedchan := ... 阅读全文
摘要:
I am focusing on this project: http://www.goinggo.net/2013/12/sample-web-application-using-beego-and.html this weekend.see: http://docs.mongodb.org/ma... 阅读全文
摘要:
Recently, I study the package net/url of Golang.I was puzzled about the escape and unescape of url string.then I find a clear and accurate answer at:h... 阅读全文
摘要:
from 《Go语言.云动力》 1 package main 2 3 import ( 4 "io" 5 "log" 6 "net/http" 7 "os" 8 "os/exec" 9 "strconv" 10 ) 11 12 v... 阅读全文
摘要:
I list some questions in Go in my daily life and the corresponding answer.QA 1.the reader <-channel will be blocked until the writer write the channel... 阅读全文