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
Keep packages backwards compatible
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Ernesto Jiménez
February 05, 2017
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Keep packages backwards compatible
FOSDEM 2017 talk on keeping Go packages backwards compatible
Ernesto Jiménez
February 05, 2017
More Decks by Ernesto Jiménez
See All by Ernesto Jiménez
From Zero to 400 webhooks/second in 24 hours
ernesto_jimenez
0
130
Learning Go - Build your first Slack app using Go and App Engine
ernesto_jimenez
0
180
Inception. Go programs that generate Go code
ernesto_jimenez
3
470
Other Decks in Programming
See All in Programming
Dockerfile CMD for Node.js
grazie1999
0
160
Hello, Hiroshima Geospatial Data! — Exploring DoboX with Python
ra0kley
0
150
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
180
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
750
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
730
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
660
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
130
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
790
Deep dive into the select statement (GopherCon UK)
jespino
0
160
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
270
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
260
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
120
Featured
See All Featured
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.1k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
490
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
370
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
590
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
510
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Become a Pro
speakerdeck
PRO
31
6.2k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
400
Skip the Path - Find Your Career Trail
mkilby
1
210
The browser strikes back
jonoalderson
0
1.6k
Transcript
keep packages backwards compatible
some tips
Small APIs commit to everything you export
Export fewer interfaces
package example type Service interface { Process() } func New()
Service { return &service{} }
package example type Service interface { Process() NewMethod() // ⚡
} func New() Service { return &service{} }
Receive interfaces Return structs
package example type Service struct { // ... } func
New() *Service { return &Service{} }
Export your input interfaces
package example func Process(in input) error { // ... }
// ⚠ type input interface { // ... }
None
// Input exported for documentation type Input interface { //
... } func Process(in Input) error { // ... }
Keeping interfaces to yourself
package testing type TB interface { Error(args ...interface{}) Fail() //
... // contains filtered or unexported methods }
package testing type TB interface { Error(args ...interface{}) Fail() //
... // A private method to prevent users implementing // interface and so future additions to it will // violate Go 1 compatibility. private() }
Nice optional params
cr, _ := crawler.New() cr.Crawl("http://godoc.org", process)
cr, _ := crawler.New( crawler.WithAllowedHosts("godoc.org"), ) cr.Crawl("http://godoc.org", process)
cr, _ := crawler.New( crawler.WithAllowedHosts("godoc.org"), crawler.WithMaxDepth(4), ) cr.Crawl("http://godoc.org", process)
func New(opts ...Option) (*Simple, error) type Option func(*options) error type
options struct
// WithMaxDepth sets the max depth of the crawl func
WithMaxDepth(depth int) Option { return func(opts *options) error { if depth < 0 { return fmt.Errorf("invalid depth: %d", depth) } opts.maxDepth = depth return nil } }
None
Be backwards compatible!
twitter.com/ernesto_jimenez
[email protected]