Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Go At Work
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Bryan Liles
December 18, 2014
Programming
0
240
Go At Work
You know how to program Go. How do you program Go at work?
Bryan Liles
December 18, 2014
Tweet
Share
More Decks by Bryan Liles
See All by Bryan Liles
DevOps Days MSP 2017
bryanl
2
1.1k
Velocity 2017 SJ: Application Tracing
bryanl
2
370
Application Ops 1.0
bryanl
1
200
DevOoops Mastery
bryanl
0
83
The (Ruby) Sims
bryanl
1
160
How Vs Why
bryanl
0
150
ruby -pi -e.bak - Windy City Rails
bryanl
1
300
Arrrr Camp 2012: Simulating the World with Ruby
bryanl
2
540
Other Decks in Programming
See All in Programming
2026年 エンジニアリング自己学習法
yumechi
0
130
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
180
Fluid Templating in TYPO3 14
s2b
0
130
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
190
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
660
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
300
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
260
CSC307 Lecture 05
javiergs
PRO
0
500
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
450
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
130
Featured
See All Featured
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Balancing Empowerment & Direction
lara
5
880
Skip the Path - Find Your Career Trail
mkilby
0
53
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
3.9k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
280
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
63
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
48
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
270
Transcript
digitalocean.com Go At Work
digitalocean.com Go At DigitalOcean
digitalocean.com Bryan Liles @bryanl @digitalocean
digitalocean.com Wow GO!
digitalocean.com
digitalocean.com Dependencies :|
digitalocean.com package main import "github.com/go-martini/martini" func main() { m :=
martini.Classic() m.Get("/", func() string { return "Hello world!" }) m.Run() }
digitalocean.com package main import ( "fmt" "net/http" "github.com/codegangsta/negroni" ) func
main() { mux := http.NewServeMux() mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { fmt.Fprintf(w, "Hello world!") }) n := negroni.Classic() n.UseHandler(mux) n.Run(":3000") }
digitalocean.com package main import ( "fmt" "net/http" ) func handler(w
http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello world!") } func main() { http.HandleFunc("/", handler) http.ListenAndServe(":3000", nil) }
digitalocean.com package main import ( "fmt" "net/http" "github.com/gorilla/mux" ) func
main() { r := mux.NewRouter() r.HandleFunc("/", homeHandler) http.Handle("/", r) http.ListenAndServe(":3000", nil) } func homeHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello world!") }
digitalocean.com “You wouldn’t go around picking stuff off the street
and eating it. Why do so with your dependencies?”
digitalocean.com Fancy Stuff Standard Lib
digitalocean.com Standard Lib Fancy Stuff
digitalocean.com Standard Lib Fancy Stuff
digitalocean.com Fancy Stuff Standard Lib
digitalocean.com Managing the GOPATH
digitalocean.com There’s more than one way to do it.
digitalocean.com single GOPATH
digitalocean.com GOPATH for each project
digitalocean.com Dependency manager
digitalocean.com Go @digitalocean
digitalocean.com single GOPATH
digitalocean.com a DOGE
digitalocean.com vendor repos import "bits.do.co/vendor/cli"
digitalocean.com Beyond gofmt
digitalocean.com Sometimes the default sorting of your imports just doesn’t
satisfy…
digitalocean.com import ( "database/sql" "doge/log" "doge/notify" "fmt" "os" "services/migration" "time"
_ "github.com/go-sql-driver/mysql" "github.com/ianschenck/envflag" )
digitalocean.com import ( "database/sql" "fmt" "os" "time" "doge/log" "doge/notify" "services/migration"
_ "github.com/go-sql-driver/mysql" "github.com/ianschenck/envflag" )
digitalocean.com http://golang.org/pkg/go/parser/ (and friends)
digitalocean.com Test the GO
digitalocean.com You are writing tests, right?
digitalocean.com func TestSquare(t *testing.T) { expected := 25 got :=
square(5) if got != expected { t.Errorf("expected %d, got %d", expected, got) } }
digitalocean.com undefined: square
digitalocean.com func square(x int) int { return 0 }
digitalocean.com --- FAIL: TestSquare (0.00 seconds) square_test.go:14: expected 25, got
0 FAIL
digitalocean.com func square(x int) int { return 25 }
digitalocean.com $ go test . ok _/Users/bryan/gothamgo2014 0.005s
digitalocean.com func TestSquare0(t *testing.T) { expected := 0 got :=
square(0) if got != expected { t.Errorf("expected %d, got %d", expected, got) } }
digitalocean.com --- FAIL: TestSquare0 (0.00 seconds) square_test.go:23: expected 0, got
25 FAIL
digitalocean.com func square(x int) int { return x * x
}
digitalocean.com go test . ok _/Users/bryan/gothamgo2014 0.006s
digitalocean.com func TestSquare(t *testing.T) { cases := []struct { arg
int expected int }{ {5, 25}, {0, 0}, {-1, 1}, } for i, c := range cases { got := square(c.arg) if got != c.expected { t.Errorf("case %d: expected %d, got %d", i, c.expected, got) } } }
digitalocean.com looper https://github.com/nathany/looper
digitalocean.com
digitalocean.com GoConvey http://goconvey.co/
digitalocean.com
digitalocean.com • 10 things you (probably) don't know about Go
• Testing Techniques
digitalocean.com Code Reviews
digitalocean.com https://code.google.com/p/go-wiki/wiki/CodeReviewComments Start here
digitalocean.com WHY > HOW
digitalocean.com Continuous Integration
digitalocean.com Drone CI
digitalocean.com We ❤️ Artifacts
digitalocean.com Deploying GO
digitalocean.com Little Deploys = ansible
digitalocean.com Big Deploys = Chef
digitalocean.com
digitalocean.com The End.