1. 程式人生 > >Go學習路徑--相關基礎

Go學習路徑--相關基礎

區別 tps go基礎學習 can 基礎 level osi ive 可執行程序

現在開始接觸Go一段時間了,基本路徑就是看基礎學習材料,開始寫項目,有問題找解決問題的方法。這裏記錄一下學習過程。

go相關文章

  • Golang適合高並發場景的原因分析
  • go build 不同系統下的可執行文件
Golang 支持在一個平臺下生成另一個平臺可執行程序的交叉編譯功能。

1、Mac下編譯Linux, Windows平臺的64位可執行程序:
$ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build test.go
$ CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build test.go
2、Linux下編譯Mac, Windows平臺的64位可執行程序:
$ CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build test.go
$ CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build test.go
3、Windows下編譯Mac, Linux平臺的64位可執行程序:
$ SET CGO_ENABLED=0SET GOOS=darwin3 SET GOARCH=amd64 go build test.go
$ SET CGO_ENABLED=0 SET GOOS=linux SET GOARCH=amd64 go build test.go

go基礎學習材料

  • GO學習基礎材料
  • 《Go 編程基礎》
  • https://github.com/Unknwon
  • Go: break label與goto label的區別

GO學習路徑—系統包

1. flag包

  • 參考官網:https://godoc.org/flag
  • Package flag implements command-line flag parsing.
After all flags are defined, call
flag.Parse()
to parse the command line into the defined flags.

2. sync包

  • 參考:鎖和 sync 包
  • 參考:協程(goroutine)與通道(channel)
  • A WaitGroup waits for a collection of goroutines to finish. The main goroutine calls Add to set the number of goroutines to wait for. Then each of the goroutines runs and calls Done when finished. At the same time, Wait can be used to block until all goroutines have finished.

GO學習路徑—第三方開發包

1. glog日誌包

  • Leveled execution logs for Go.
  • 官網:https://code.google.com/p/google-glog/
  • The repository contains an open source version of the log package
    used inside Google. The master copy of the source lives inside
    Google, not here.

    2. goconfig配置文件工具包

  • 參考官網:https://github.com/miguel-branco/goconfig
  • 安裝: go get "github.com/msbranco/goconfig"
  • 但是該配置項目已經不更新且不建議使用了,建議使用:https://github.com/robfig/config
  • 安裝:go get github.com/robfig/config

Go學習路徑--相關基礎