[关闭]
@daaoling 2016-10-05T13:34:01.000000Z 字数 926 阅读 1791

Go 学习笔记1

Go

相关学习代码地址

https://git.oschina.net/daao/Go.git

install

Mac

tar -C /usr/local -xzf go1.6.2.darwin-amd64.tar.gz
export GOROOT=/usr/local/go
export GOPATH=~/Development/go
export PATH=$PATH:$GOROOT/bin
zjy$ go version
    go version go1.6.2 darwin/amd64

Windows

GOROOT=C:\go
Path = %GOROOT%\bin

https://golang.org/dl/

搭建本地文档

The godoc tool is intended primarily to run a documentation server in your browser on localhost.

godoc -http=":6060"

IDE

LiteIDE

http://www.golangtc.com/download/liteide

目录结构

GOPATH=/home/user/gocode

/home/user/gocode/
    src/
        foo/
            bar/               (go code in package bar)
                x.go
            quux/              (go code in package main)
                y.go
    bin/
        quux                   (installed command)
    pkg/
        linux_amd64/
            foo/
                bar.a          (installed package object)

例子

image_1as06huqcge2sjr1p7gp8b1sh3m.png-80.6kB

go install 

image_1as06h0ib92775fdpd2pq1fgp9.png-67.7kB

go build and run

image_1as06lsfpc821rdfjoq187t1dn613.png-33.3kB

运行的时候发现个错误:

./main.go:10: cannot refer to unexported name mMath.test

mMath.test 首个字母大写,无语了

参考

go help gopath

http://blog.studygolang.com/2013/01/%E5%86%8D%E7%9C%8Bgopath/

beego的作者的开源书籍 https://github.com/astaxie/build-web-application-with-golang

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注