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
Bryan Liles
December 18, 2014
Programming
0
230
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
360
Application Ops 1.0
bryanl
1
200
DevOoops Mastery
bryanl
0
72
The (Ruby) Sims
bryanl
1
140
How Vs Why
bryanl
0
130
ruby -pi -e.bak - Windy City Rails
bryanl
1
280
Arrrr Camp 2012: Simulating the World with Ruby
bryanl
2
510
Other Decks in Programming
See All in Programming
Agentic Coding: The Future of Software Development with Agents
mitsuhiko
0
100
AIともっと楽するE2Eテスト
myohei
6
2.6k
Python型ヒント完全ガイド 初心者でも分かる、現代的で実践的な使い方
mickey_kubo
1
120
PHPでWebSocketサーバーを実装しよう2025
kubotak
0
290
NPOでのDevinの活用
codeforeveryone
0
840
Claude Code + Container Use と Cursor で作る ローカル並列開発環境のススメ / ccc local dev
kaelaela
10
5.3k
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
2
550
iOS 26にアップデートすると実機でのHot Reloadができない?
umigishiaoi
0
130
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
2
820
システム成長を止めない!本番無停止テーブル移行の全貌
sakawe_ee
1
200
AI コーディングエージェントの時代へ:JetBrains が描く開発の未来
masaruhr
1
150
ニーリーにおけるプロダクトエンジニア
nealle
0
840
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
GraphQLとの向き合い方2022年版
quramy
49
14k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
740
Reflections from 52 weeks, 52 projects
jeffersonlam
351
20k
Scaling GitHub
holman
460
140k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
820
It's Worth the Effort
3n
185
28k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
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.