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
Ernesto Jiménez
February 05, 2017
Programming
0
140
Keep packages backwards compatible
FOSDEM 2017 talk on keeping Go packages backwards compatible
Ernesto Jiménez
February 05, 2017
Tweet
Share
More Decks by Ernesto Jiménez
See All by Ernesto Jiménez
From Zero to 400 webhooks/second in 24 hours
ernesto_jimenez
0
110
Learning Go - Build your first Slack app using Go and App Engine
ernesto_jimenez
0
170
Inception. Go programs that generate Go code
ernesto_jimenez
3
450
Other Decks in Programming
See All in Programming
Patterns of Patterns
denyspoltorak
0
410
AIの誤りが許されない業務システムにおいて“信頼されるAI” を目指す / building-trusted-ai-systems
yuya4
7
4.2k
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
4
1.3k
AtCoder Conference 2025
shindannin
0
880
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
240
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
210
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
180
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
200
「コードは上から下へ読むのが一番」と思った時に、思い出してほしい話
panda728
PRO
39
26k
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
430
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.5k
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
210
Featured
See All Featured
Deep Space Network (abreviated)
tonyrice
0
33
Producing Creativity
orderedlist
PRO
348
40k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
58
41k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Writing Fast Ruby
sferik
630
62k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
260
Embracing the Ebb and Flow
colly
88
4.9k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.5k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
250
The SEO identity crisis: Don't let AI make you average
varn
0
45
WENDY [Excerpt]
tessaabrams
9
35k
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]