# Vibe Coder 後端學習路徑 | Golang > 目標:能看懂 AI 生成的程式碼,知道它在做什麼 > 預估時間:Go 約 1-1.5 天 --- ## 2.1 Go 語法 — [A Tour of Go](https://go.dev/tour/) ### Welcome(快速看) - [ ] Welcome to a tour of Go ### Basics | Packages, variables, and functions(必做) - [ ] Packages - [ ] Imports - [ ] Exported names - [ ] Functions - [ ] Multiple results ⭐ *(Go 可以回傳多個值)* - [ ] Named return values - [ ] Variables - [ ] Short variable declarations ⭐ *(`:=` 語法)* - [ ] Basic types - [ ] Zero values - [ ] Type conversions - [ ] Constants ### Flow control | Flow control statements(必做) - [ ] For ⭐ *(Go 只有 for,沒有 while)* - [ ] For is Go's "while" - [ ] If - [ ] If with a short statement - [ ] If and else - [ ] Switch - [ ] Defer ⭐ *(很常見,用於清理資源)* ### More types | Structs, slices, and maps(必做,重點!) - [ ] Pointers *(基本了解即可)* - [ ] Structs ⭐⭐⭐ *(Go 沒有 class,這是替代品)* - [ ] Struct fields - [ ] Pointers to structs - [ ] Struct Literals - [ ] Arrays - [ ] Slices ⭐⭐ *(比 Array 常用)* - [ ] Slices are like references - [ ] Slice literals - [ ] Slice defaults - [ ] Slice length and capacity - [ ] Nil slices - [ ] Creating a slice with make - [ ] Slices of slices *(略讀)* - [ ] Appending to a slice ⭐ - [ ] Range ⭐ *(for 迴圈遍歷用)* - [ ] Maps ⭐⭐ *(類似 Python 的 dict)* - [ ] Map literals - [ ] Mutating Maps - [ ] Function values - [ ] Function closures *(了解概念)* ### Methods and interfaces(重要) - [ ] Methods ⭐⭐ *(Go 怎麼做 OOP)* - [ ] Methods are functions - [ ] Pointer receivers ⭐ - [ ] Interfaces ⭐⭐ *(理解概念即可)* - [ ] Interfaces are implemented implicitly - [ ] Interface values - [ ] Empty interface *(`interface{}`,很常見)* - [ ] Type assertions - [ ] Type switches - [ ] Errors ⭐⭐⭐ *(最重要!Go 的錯誤處理核心)* ### 可之後再學 - [ ] ~~Generics~~ *(泛型,進階主題)* - [ ] ~~Concurrency~~ *(goroutine/channel,進階主題)* --- ## 2.2 Gin 框架 — [官方 Quickstart](https://gin-gonic.com/docs/) - [ ] Quickstart — https://gin-gonic.com/docs/quickstart/ - [ ] 看懂基本路由和 JSON 回傳 ### 補充:看一個完整範例 - [ ] 找一個「Gin REST API tutorial」影片(YouTube 30-60 分鐘的) - 關鍵字:`Go Gin REST API tutorial` - 目標:看懂路由、Context、JSON binding 怎麼運作 --- ### 2.3 [Go 補充資源](https://gobyexample.com) 當你遇到不懂的語法時,來這裡查: - [ ] 收藏 Go by Example 作為參考手冊 --- ## 學習完成後的自我檢核 - [ ] 我看到 `if err != nil` 不會嚇到,知道這是錯誤處理 - [ ] 我知道 `type User struct {}` 是在定義資料結構 - [ ] 我知道 `c.JSON(200, data)` 是在回傳 JSON - [ ] 我知道 `:=` 和 `var` 的差別
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.