一. http客户端
1.
http.Client和http.NewRequest来模拟请求
package main import ( "net/http" "io/IoUtil" "fmt" ) func main() { client := &http.Client{} reqest,_ := http.NewRequest("GET","http://www.baidu.com",nil) reqest.Header.Set("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") response,_ := client.Do(reqest) if response.StatusCode == 200 { body,_ := IoUtil.ReadAll(response.Body) bodystr := string(body); fmt.Println(bodystr) } }
配置Gocode ~ cd $GOPATH/src/github.com/nsf/gocode/vim ~ ./update.bash ~ gocode set propose-builtins true propose-builtins true ~ gocode set lib-path "/home/border/gocode/pkg/linux_amd64" 24lib-path "/home/border/gocode/pkg/linux_amd64" ~ gocode set