go_course icon indicating copy to clipboard operation
go_course copied to clipboard

個人多年來學習與實作上的心得筆記

Golang 學習筆記

個人多年來學習與實作上的心得筆記,本文件適合已有一種程式語言經驗的同好閱讀,內容如有錯誤或建議,可以隨時與我連絡。

開發環境

主要資料來源

  1. 官網:https://golang.org/
  2. 線上學習:A tour of Go
  3. The Go Programming Language
  4. Go Web Programming
  5. Go System Programming
  6. Go Mobile
  7. Go WebAssembly

其他資料

  1. Go Dev
  2. Go Wiki
  3. Awesome Go
  4. Effective Go (必讀)

Summary

  • 本文件

一、Go 基礎說明

  • 01. 開發環境與語言簡介
    • 參考文件
    • IDE 設定
    • 與 C/Java/PHP 簡單比較
  • 02. 程式結構與語法
    • 關鍵字
    • 基本語法
    • iota
    • type
    • 指標
    • Package
  • 03. Data Types - Basic Types
    • Number
    • Boolean
    • String
    • Zero Value
  • 04. Data Types - Aggregate Types
    • Array
    • Struct
    • JSON
  • 05. Data Types - Reference Types
    • Slice
      • Append Slice
    • Map
  • 06. Functions
    • 語法
    • Pass By Value in Value and Reference Types.
    • First Class
  • 07. Methods
    • Methods in Value and Pointer
  • 08. Interface
    • Interface in Struct and Pointer
    • Interface Value
    • Interface puzzle (interface nil problem)
  • 09. Go and OOP
    • Encapsulation
    • Inheritance (fake)
    • Polymorphism
  • 10. Defer and Error Handling
    • Defer
      • Closure Binding
    • Panic and Recover
    • Errors (new feature in Go 1.13)
  • 14. Testing
  • Go Module
  • TODO: Go Workspaces
  • Go Build
    • Build cross Platform
    • Build Constraints
  • embed

二、多執行緒

  • 11. Concurrency - Goroutine
    • Keyword go
    • sync.WaitGroup
    • Mutex
    • Atomic
  • 12. Concurrency - Channel
    • Buffered channel
    • Producer and Consumer Pattern
    • Actor Pattern
    • select to monitor channels
  • 13. Context

三、實作應用

  • 15. flag and spf13 Cobra/Viper
  • 16. MySQL
  • 17. Web
    • Go Template 語法
    • Context in Request (Request-Scoped)
    • Cookie
  • Gorilla
    • Mux
    • Middleware
    • Shema
    • Secure Cookie
    • CSRF
  • TODO: Echo
  • 18. RESTful
    • RESTful using Gorilla
  • 19. gRPC (Deprecated)
    • Protobuf
      • Protoc (Protobuf Compliler)
    • gRPC (Client and Service)

四、Go 進階功能

  • 20. Reflection and Struct Tag

    • Type and Value
    • Strut Tag
    • Check Interface implementation
    • Zero Value
    • Make Slice
    • Make Map
    • Make Function
  • 21. Cowork with C/C++

    • Go unsafe Package
    • Go String and *C.char
    • Go call C
      • Swig
      • DIY
    • C Call Go with Static Library
  • Type Parameters and Go Generic

五、實驗中功能

  • Go WebAssembly
    • WebAssembly Introduction
    • DOM in Go WASM
      • Selector
      • Property
      • Method
      • Event
    • Create a Javascript Object
    • Go call Javascript
    • Javascript Call Go
    • File and FileReader
    • Conversion Javascript Uint8Array and Go Byte Slice

新增

  • Go 1.13 Error 功能
  • Go 1.16 embed 功能
  • Go WebAssembly
  • Go Generic & Go2Go (Go 1.8)
  • Go Workspaces
  • Echo
  • Go 1.19 atomic 功能