zoukankan      html  css  js  c++  java
  • go学习与记录

    搭建go开发环境:http://studygolang.com/articles/5406

    日志相关:https://github.com/hpcloud/tail

    go定时器:http://studygolang.com/articles/1881

    go文档:http://www.360doc.com/content/15/0918/08/7362_499866824.shtml

    go反射调用,xml处理:http://studygolang.com/articles/337

    环境搭建:http://studygolang.com/articles/897

    go的select用法:http://www.jb51.net/article/74119.htm

    反射:http://studygolang.com/articles/2157 

    go的反射:http://studygolang.com/articles/896

          http://studygolang.com/articles/1251

            http://studygolang.com/articles/896

    go的chanl:http://studygolang.com/articles/814

           并发:http://www.oschina.net/code/snippet_170216_25349

    go的interface : http://www.jb51.net/article/56812.htm

    http://www.tuicool.com/articles/meIN7bU

    【Go语言】I/O专题

    http://www.cnblogs.com/Mike-zh/p/3793685.html?utm_source=tuicool&utm_medium=referral

     go的相关包:http://labix.org/    

    例子:

    https://wiki.ubuntu.com/gozk   

    http://labix.org/pipe

    http://labix.org/gommap

    时间转换:http://studygolang.com/articles/2634

    go架包:https://godoc.org/

    分为三步 

    第一步 用http.get 获取到res.Body 这个流
    第二步 用os.Creat创建文件并取到文件
    第三步 io.Copy把得到的res.Body拷贝到文件的流里面

    获得架包:http://gopkg.in/puerkitobio/goquery.v0

    // goGetJpg
    package main
    
    import (
    "fmt"
    "github.com/PuerkitoBio/goquery"
    "io"
    "net/http"
    "os"
    )
    
    func main() {
    x, _ := goquery.NewDocument("http://www.fengyun5.com/Sibao/600/1.html")
    urls, _ := x.Find("#content img").Attr("src")
    res, _ := http.Get(urls)
    file, _ := os.Create("xxx.jpg")
    io.Copy(file, res.Body)
    fmt.Println("下载完成!")
    }

    go 的跨域

    在使用golang做web的应用程序的时候,最容易碰到跨域问题了,跨域就是www.a.com访问www.b.com的文件。但是在浏览器里,为了安全起见,这样做是不允许的,这就是js的同源策略了。不懂的话google一下。1.golang做web的应用程序,不用使用像apache的web服务器,因为它自己可以构造一个web服务器。这样问题就来了,因为你使用js做前台,golang做后台,这样js传值的时候,是可以传到服务器的,并且是可以进行跨域访问的,因为golang构造的服务器与你前台就造成了跨域问题了。而ajax传值是传到服务器端的,并且可以进行跨域访问,所以我在开发的时候果断使用了它。
    2而在golang接受传值之后,要返回信息给前台,这是golang里面就要设置可以进行跨域访了。设置就是设置它的header
    w.Header().Set('Access-Control-Allow-Origin', '*')//允许访问所有域
    w.Header().Add('Access-Control-Allow-Headers','Content-Type')//header的类型
    w.Header().Set('content-type','application/json')//返回数据格式是json

    idea配置golang

    用os x的installer pkg安装go到默认路径/usr/local/go下面之后,进入idea提示找不到GOROOT和GOPATH
    
    直接在terminal输入下列命令
    
    launchctl setenv GOROOT /usr/local/go
    launchctl setenv GOPATH /Users/yourname/go
    Go语言TCP Socket编程
    http://studygolang.com/articles/5372
    go语言并发;
    http://studygolang.com/articles/4635

    也谈并发与并行

    http://studygolang.com/articles/4474

     
    supervisor运行golang守护进程
    http://studygolang.com/articles/4480

    Golang在京东列表页实践总结


    http://studygolang.com/articles/4744
    基于 MySQL 的 ID 生成器 idgo
    http://studygolang.com/p/idgo
    go的Json开发包
    
    http://studygolang.com/p/jason

    go 语言学习思维导航图:
    http://yougg.github.io/static/gonote/GolangStudy.html

    godeps

    http://studygolang.com/articles/2147

  • 相关阅读:
    PHP
    单引号和双引号的区别和效率问题
    SFDC 401认证准备及考试
    SFDC 401 最新考试真题
    3 report formats of SFDC
    HTML输入框点击内容消失
    RDD的转换操作(续)
    RDD的转换操作
    SparkContext和RDD的说明
    集群模式相关概念
  • 原文地址:https://www.cnblogs.com/8899man/p/5117329.html
Copyright © 2011-2022 走看看