由於近幾年工作關係,對 Go 的體驗有新的想法,再加上這邊的內容累積很多歷史已經不適用,我計劃另開新的筆記重新整理。希望能夠幫助到更多人。
新的筆記在這裡:https://github.com/kigichang/go-notebook。
這邊的資料將不再更新,僅供參考。
個人多年來學習與實作上的心得筆記,本文件適合已有一種程式語言經驗的同好閱讀,內容如有錯誤或建議,可以隨時與我連絡。
- GO 版本: Go 1.22
- 開發環境: Mac OS (arm64)
- 開發工具: VSCode
- 文件使用 Markdown Preview Enhanced 撰寫,請安裝完環境後再閱讀。
- Source on Github
- 官網:https://golang.org/
- 線上學習:A tour of Go
- The Go Programming Language
- Go Web Programming
- Go System Programming
- Go Mobile
- Go WebAssembly
- 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
- Slice
- 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)
- Defer
- 14. Testing
- Go Module
- TODO: Go Workspaces
- Go Build
- Build cross Platform
- Build Constraints
- embed
- 11. Concurrency - Goroutine
- Keyword
go
sync.WaitGroup
- Mutex
- Atomic
- Keyword
- 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)
- Protobuf
-
- Type and Value
- Strut Tag
- Check Interface implementation
- Zero Value
- Make Slice
- Make Map
- Make Function
-
- Go
unsafe
Package - Go String and *C.char
- Go call C
- Swig
- DIY
- C Call Go with Static Library
- Go
- 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 功能