Go 自學筆記
- GO 版本: Go 1.13
- 開發環境: Mac OS
- Source on Github
- 文件使用 Markdown 撰寫,建議使用 Markdown Preview Enhanced 閱讀
資料主要來自:
- 官網:https://golang.org/
- 線上學習:A tour of Go
- The Go Programming Language
- Go Web Programming
- Go System Programming
- Go Mobile
- Go WebAssembly
其他資源:
Summary
- Summary
- 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
- Build and Dependency
- Build cross platform
- Go Module
go mod
- 08 Interface
- Interface in Struct and Pointer
- Interface value
- Interface puzzle (interface nil problem)
- 09 OOP in Go
- Encapsulation
- Inheritance (fake)
- Polymorphism
- 10 Defer and Error Handling
- Defer
- Closure Binding
- Panic and Recover
- Errors (new feature in Go 1.13)
- Defer
- 11 Concurrency - Goroutine
- Keyword
go
sync.WaitGroup
- Keyword
- 12 Concurrency - Channel
- Buffered channel
- Producer and Consumer Pattern
- Actor Pattern
select
to monitor channels
- 13 Context
- 14 Testing
- 15 flag and spf13 Cobra/Viper
- 16 MySQL
- 17 Web (Gorilla web toolkit)
- Go Template 語法
- Context in Request (Request-Scoped)
- Cookie
- Gorilla
- Mux
- Middleware
- Shema
- Secure Cookie
- CSRF
- Mux
- 18 RESTful, Protobuf and gRPC
- RESTful using Gorilla
- Protobuf
- Protoc (Protobuf Compliler)
- gRPC (Client and Service)
- 19 Reflection and Struct Tag
- Type and Value
- Strut Tag
- Check Interface implementation
- Zero Value
- Make Slice
- Make Map
- Make Function
- 20 Cowork with C/C++
- Go
unsafe
Package - Go String and *C.char
- Go call C
- Swig
- DIY
- C Call Go with Static Library
- Go
- 21 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 WebAssembly