SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
Golang
• 去年買了⼀本書:深入淺出Go

• ⾃⼰⽬前還不算完全掌握Golang

• 只是過年把它⼤概的看完,

• 指標

• 模組

• 多執⾏緒/並⾏處理 ...需要後續補⾜

• 謝謝後端團隊的⼤家讓我有機會使⽤在專案上。
動機
• 是Google開發的⼀種靜態強型別、編譯型、並發型,並具有垃圾
回收功能的程式語⾔。(From wiki)

• https://golang.org/
簡介
• go build

• go fmt

• go test
常⾒指令
• 以猜數字⼩遊戲為例, 簡介 Golang 基本元素

• https://github.com/r567tw/go-practice/blob/master/makeGame/
main.go
猜數字⼩遊戲
• go.mod 類似 composer.json , package.json 註明需要的modules

• go.sum 類似 yarn.lock , package-lock.json , ⽤來做版本的校對
淺談 go.mod & go.sum
• Manual version 

• CDK version (如何獲取環境變數, 以Docker為例)

• SAM version (API Gateway 版本, 以SAM預設專案為例)

• 以拆帳報表專案為例
Go ❤ Lambda
• Event 定義的如果需要匯出請務必開頭為⼤寫

• if / for ⼤括號務必要在同⼀⾏

• 請記得使⽤ github.com/aws/aws-lambda-go/lambda
• https://docs.aws.amazon.com/zh_tw/lambda/latest/dg/
golang-handler.html
結論: 幾個注意事項(我踩過的坑)
• Show you codes

• // go:embed input.txt
Golang 1.16 ⿊魔法: embed
• https://medium.com/
%E5%BE%AE%E5%B3%AF%E9%A3%9B%E7%BF%94/
golang-go-mod-
%E8%B5%B7%E6%89%8B%E5%8B%A2-39a0be969
ff
c

• https://openhome.cc/Gossip/Go/Module.html

• https://studygolang.com/articles/25658

• https://mileslin.github.io/2020/01/Golang/Go-Module-
%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B%E7
%AD%86%E8%A8%98/
參考資料(關於go.mod & go.sum)
• https://zh.wikipedia.org/zh-tw/Go

• https://golang.org/

• https://docs.aws.amazon.com/zh_tw/lambda/latest/dg/lambda-
golang.html

• https://github.com/r567tw/go-practice

•
參考資料

Contenu connexe

Tendances

Tendances (6)

用 Drone 打造 輕量級容器持續交付平台
用 Drone 打造輕量級容器持續交付平台用 Drone 打造輕量級容器持續交付平台
用 Drone 打造 輕量級容器持續交付平台
 
2019/7/27 先別開 Branch 了,你聽過 Feature Toggle 嗎?
2019/7/27 先別開 Branch 了,你聽過 Feature Toggle 嗎?2019/7/27 先別開 Branch 了,你聽過 Feature Toggle 嗎?
2019/7/27 先別開 Branch 了,你聽過 Feature Toggle 嗎?
 
該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?
 
Linking error
Linking errorLinking error
Linking error
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Proto actor 串接 Go 與 C# 簡易上手
Proto actor 串接 Go 與 C# 簡易上手Proto actor 串接 Go 與 C# 簡易上手
Proto actor 串接 Go 與 C# 簡易上手
 

Similaire à Golang (10)

Introduction to Golang final
Introduction to Golang final Introduction to Golang final
Introduction to Golang final
 
大獅子與小獅子的分享
大獅子與小獅子的分享大獅子與小獅子的分享
大獅子與小獅子的分享
 
數學系的資訊人生
數學系的資訊人生數學系的資訊人生
數學系的資訊人生
 
導入 Flutter 前你應該知道的事
導入 Flutter 前你應該知道的事導入 Flutter 前你應該知道的事
導入 Flutter 前你應該知道的事
 
20121115 Slides
20121115 Slides20121115 Slides
20121115 Slides
 
[DCTPE2011] 11) Drupal 是好的生財工具嗎? 1. 網站標案經驗分享 x 2
[DCTPE2011] 11) Drupal 是好的生財工具嗎?  1. 網站標案經驗分享 x 2[DCTPE2011] 11) Drupal 是好的生財工具嗎?  1. 網站標案經驗分享 x 2
[DCTPE2011] 11) Drupal 是好的生財工具嗎? 1. 網站標案經驗分享 x 2
 
Django入门
Django入门Django入门
Django入门
 
優雅的在 Emacs 中使用 git
優雅的在 Emacs 中使用 git優雅的在 Emacs 中使用 git
優雅的在 Emacs 中使用 git
 
開放原始碼 Ch1.3 intro - oss - google codes (ver 2.0)
開放原始碼 Ch1.3   intro - oss - google codes (ver 2.0)開放原始碼 Ch1.3   intro - oss - google codes (ver 2.0)
開放原始碼 Ch1.3 intro - oss - google codes (ver 2.0)
 
不妥協的河蟹之道
不妥協的河蟹之道不妥協的河蟹之道
不妥協的河蟹之道
 

Golang