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
260
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Go At Work
You know how to program Go. How do you program Go at work?
Bryan Liles
December 18, 2014
More Decks by Bryan Liles
See All by Bryan Liles
DevOps Days MSP 2017
bryanl
2
1.2k
Velocity 2017 SJ: Application Tracing
bryanl
2
380
Application Ops 1.0
bryanl
1
220
DevOoops Mastery
bryanl
0
94
The (Ruby) Sims
bryanl
1
170
How Vs Why
bryanl
0
180
ruby -pi -e.bak - Windy City Rails
bryanl
1
320
Arrrr Camp 2012: Simulating the World with Ruby
bryanl
2
570
Other Decks in Programming
See All in Programming
Built Our Own Background Agent at LayerX
layerx
PRO
10
6k
メールのエイリアス機能を履き違えない
isshinfunada
0
250
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
220
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
380
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
1.6k
What's New in Android 2026
veronikapj
0
270
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
360
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
370
コンパウンドプロダクト開発のためのローカルプロセスマネージャー再発明 #layerxgo
izumin5210
0
120
これって Effect でできたのでは? / TSKaigi Mashup Kansai #2
susisu
0
250
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.4k
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
350
Featured
See All Featured
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
490
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
210
Testing 201, or: Great Expectations
jmmastey
46
8.2k
AI: The stuff that nobody shows you
jnunemaker
PRO
9
940
The Cost Of JavaScript in 2023
addyosmani
55
10k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
We Are The Robots
honzajavorek
0
300
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Bash Introduction
62gerente
615
220k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
970
The Mindset for Success: Future Career Progression
greggifford
PRO
0
470
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.