Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Go - Getting Started
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
nyo
September 14, 2018
Programming
30
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Go - Getting Started
nyo
September 14, 2018
Other Decks in Programming
See All in Programming
Domain-Driven Transformation
hschwentner
2
2.3k
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
230
ジョジョの世界をXRで再現する
mofurune
0
170
ActionController meets Protocol Buffers
sorah
0
530
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
600
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
560
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
220
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
370
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
380
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
1.2k
AmebaブログはKMPから卒業します
kmars0605
0
190
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
Featured
See All Featured
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1k
Bash Introduction
62gerente
615
220k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Producing Creativity
orderedlist
PRO
348
41k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.2k
Practical Orchestrator
shlominoach
192
12k
Typedesign – Prime Four
hannesfritz
42
3.2k
Being A Developer After 40
akosma
92
590k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
500
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Transcript
Lesson 1 Getting Started SEP 14 2018 Nyo Backend Developer
Today’s Outline 認識 Go 01 安裝與環境 編輯器 開始寫 Go 語言特色
Q & A 02 03 04 05 06
認識 Go Introduction for Go
很多問題要解決 Introduction for Go • 提高開發效率 • 大量程式碼的管理 • 程式碼風格統一
• 大量伺服器佈署 • ...等等
Go Gopher Introduction for Go
Logo Introduction for Go
發佈歷史 Introduction for Go • 2009年11月發表專案 • 2012年3月發佈 1.0 版
• 2018年8月發佈 1.11 版
優勢 Introduction for Go • 老爸是 Google • 開源專案 •
編譯成執行檔,執行性能較好 • 易於開發維護 • function programing (not OOP) • goroutines 的優勢
Tool Introduction for Go • go get • go run
• go test • go build • go install
哪些專案使用 Go Introduction for Go • Kubernetes • Hugo •
Prometheus • Fzf • ...etc
安裝與環境 Installation
Download Installation curl -O https://storage.googleapis.com/golang/go1.1 0.4.linux-amd64.tar.gz
Install Installation sudo tar -C /usr/local -xzf go1.10.4.linux-amd64.tar.gz
Setting PATH Installation export PATH=$PATH:/usr/local/go/bin
GVM Installation • https://github.com/moovweb/gvm
編輯器 Editor
選擇編輯器 Editor • Vim (vim-go) • Vscode (go for vscode)
• Goland • ...etc
Tools for Editor Editor • Auto completion (gocode • Code
navigation (godef, guru • Format (gofmt, goimport • Lint (golint, gometalinter • Debug (delve
開始寫 Go Write Go Code
檔案結構 Write Go Code
GOPATH Write Go Code • Default ◦ $HOME/go • PATH
◦ export PATH=$PATH:$(go env GOPATH)/bin
Hello World Demo
學習資源 Learning Resource
官方教學網站 Learning Resource • http://tour.golang.org/ • https://golang.org/doc/effective_go.html • https://play.golang.org/
語言特色 Features of Go
Strongly Typed Features of Go var i int var c,
python, java bool var counter int = 5 var message string = "Hello" Variable declaration and initialization var counter = 5 var message = "Hello" func main(){ counter := 5 message := "Hello" } Automatically assign type
Struct Features of Go type Vertex struct { X int
Y int z int // private } Defined v := Vertex{ X: 1, Y: 2, } v.X = 4 Create instance
Functional Programming Features of Go func add(m, n int) int
{ return m + n } Function type MyInt struct { m int n int } func (i *MyInt) sum() int { return i.m + i.n } Method
Package Features of Go import ( “math/rand" ) rand.Intn(10) Import
package import ( "github.com/gin-gonic/gin" "github.com/gorilla/websocket" ) gin.New() Import third package
Concurrency: Goroutines and Channel Features of Go func say(s string)
{ fmt.Println(s) } go say("world") Goroutines By default, sends and receives block until the other side is ready. ch := make(chan int) ch <- v // Send v to channel ch. v := <-ch // Receive from ch, and // assign value to v. Channel
Interface Features of Go type Abser interface { Abs() float64
} Defined Interface type MyFloat float64 func (f MyFloat) Abs() float64 { if f < 0 { return float64(-f) } return float64(f) } Implemented interface
Gin + Gorilla websocket Demo
Q & A
Reference • https://golang.org/doc/code.html • https://www.slideshare.net/appleboy/go-92006325 • https://github.com/golang/go/wiki • https://en.wikipedia.org/wiki/Go_(programming_language) •
https://blog.golang.org/gopher • https://github.com/nyogjtrc/practice-go
Thank you! Ending