SlideShare uma empresa Scribd logo
1 de 28
Baixar para ler offline
digitalocean.com
Go Generate Pipelines
Pipelines?
Pipelines
• https://blog.golang.org/pipelines
• concurrency pattern
• “stages connected by channels"
Pipelines
• produce a channel of stuff
• creates at least one goroutine
• source -> [middle] -> [middle] -> sink
Example
• https://play.golang.org/p/4Awrr2PgFo
Pattern
• directional channels
• goroutine
• close what you create
• for/range to completion (previous stage closes)
Concurrency
• increase the concurrency by stage
• easy to add
• https://play.golang.org/p/_qQVZ0Rh73
Generators vs Pipeline
• generators create values when you ask for them
• pipeline produce values before you ask for them
• https://play.golang.org/p/R_XHMu1jBz
Real Program Concerns
• leaking goroutines
• cancelation
• errors
Leaking Goroutines
• every goroutine must terminate!
• pipelines create many goroutines
• https://play.golang.org/p/jUZIv6H4l2
Cancelation Strategies
• exit program
• close source stage let downstream drain naturally
• close all stages
Exit program
• easy
• really really easy
Close source & drain downstream
• source closing trickles down to consumers
• all goroutines can exit
• https://play.golang.org/p/pRpNspMG2z
Close all stages
• `out <-` must be interruptible everywhere
• every channel producing function provided “done”
• https://play.golang.org/p/Rd-hEVic0O
Errors
• can happen anywhere
• second output channel
• https://play.golang.org/p/aUv5MrD7Bj
Errors Take 2
• https://godoc.org/golang.org/x/net/context
• need a “pipeline context”
• signal done and place to write errors
• WIP idea
• https://play.golang.org/p/-sn3QGpc7X
Pipelines
• `out <-` always interruptible by `done`
• close what you create
• error channel/pipeline context
• often repetitive…
Go Generate
Go Generate
• since go1.4
• “comments” in your go project
• //go:generate [command] [args…]
Just a command
• generate say hi (for fun)
• generate rm -fr / (for evil)
• generate printenv (for understanding)
Not a shell…
• go:generate echo $EDITOR > /tmp/nope
• go:generate cat /tmp/file | grep something
But shellish…
• $GOFILE
• $GOPACKAGE
• $GOARCH
• $GOOS
• go:generate something -out=$GOARCH_something.go
Meant to write files
• stderr for communicating to the user
• silent in proper operation
• side effect (file) then committed to repository
• can also generate _test.go file
Pipeliner
My common pipelines
• batch(<-chan Event) (<-chan []Event)
• flatMap(<-chan gzipfile) (<-chan Event)
• from([]Event) (<-chan Event)
Pipeliner
• side-project
• saves me time
• may annoy you (bad error messages)
• github.com/supershabam/pipeliner
digitalocean.com
close(talk)
digitalocean.com
questions?

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everythingZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
 
Symfony Nano Framework
Symfony Nano FrameworkSymfony Nano Framework
Symfony Nano Framework
 
Plone and docker
Plone and dockerPlone and docker
Plone and docker
 
Introduction to composer
Introduction to composerIntroduction to composer
Introduction to composer
 
Kotlin 讀書會 #1
Kotlin 讀書會 #1Kotlin 讀書會 #1
Kotlin 讀書會 #1
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
 
Basic git
Basic gitBasic git
Basic git
 
Vagrant - PugMI
Vagrant - PugMIVagrant - PugMI
Vagrant - PugMI
 
GitHub Slack Bot
GitHub Slack BotGitHub Slack Bot
GitHub Slack Bot
 
Haibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy againHaibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy again
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
 
Github - Le Wagon Melbourne
Github - Le Wagon MelbourneGithub - Le Wagon Melbourne
Github - Le Wagon Melbourne
 
Git tutorial
Git tutorial Git tutorial
Git tutorial
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Culerity and Headless Full Stack Integration Testing
Culerity and Headless Full Stack Integration TestingCulerity and Headless Full Stack Integration Testing
Culerity and Headless Full Stack Integration Testing
 
Minishift (Run OpenShift locally)
Minishift (Run OpenShift locally)Minishift (Run OpenShift locally)
Minishift (Run OpenShift locally)
 
Git introduction
Git introductionGit introduction
Git introduction
 
Hello, Git!
Hello, Git!Hello, Git!
Hello, Git!
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 

Destaque

JornadasFCCN2015-LigacaoRCTScomPeeringBGPv3
JornadasFCCN2015-LigacaoRCTScomPeeringBGPv3JornadasFCCN2015-LigacaoRCTScomPeeringBGPv3
JornadasFCCN2015-LigacaoRCTScomPeeringBGPv3
Jorge Matias
 
IPv6 on Portuguese Public Administration - Transition of services to IPv6
IPv6 on Portuguese Public Administration - Transition of services to IPv6IPv6 on Portuguese Public Administration - Transition of services to IPv6
IPv6 on Portuguese Public Administration - Transition of services to IPv6
Jorge Matias
 
Climate Change White Paper_Published
Climate Change White Paper_PublishedClimate Change White Paper_Published
Climate Change White Paper_Published
Alita Ostapkovich
 
Effects of Yoga on Clinical Blood Pressure
Effects of Yoga on Clinical Blood PressureEffects of Yoga on Clinical Blood Pressure
Effects of Yoga on Clinical Blood Pressure
Kerri-Anne Ciesielka
 

Destaque (17)

SAP updated resume
SAP updated resumeSAP updated resume
SAP updated resume
 
Weimar republic final
Weimar republic finalWeimar republic final
Weimar republic final
 
Ec
EcEc
Ec
 
JornadasFCCN2015-LigacaoRCTScomPeeringBGPv3
JornadasFCCN2015-LigacaoRCTScomPeeringBGPv3JornadasFCCN2015-LigacaoRCTScomPeeringBGPv3
JornadasFCCN2015-LigacaoRCTScomPeeringBGPv3
 
IPv6 on Portuguese Public Administration - Transition of services to IPv6
IPv6 on Portuguese Public Administration - Transition of services to IPv6IPv6 on Portuguese Public Administration - Transition of services to IPv6
IPv6 on Portuguese Public Administration - Transition of services to IPv6
 
Strategia Komunikacyjna Fundacji Misericors jako przykład nowoczesnej komunik...
Strategia Komunikacyjna Fundacji Misericors jako przykład nowoczesnej komunik...Strategia Komunikacyjna Fundacji Misericors jako przykład nowoczesnej komunik...
Strategia Komunikacyjna Fundacji Misericors jako przykład nowoczesnej komunik...
 
Climate Change White Paper_Published
Climate Change White Paper_PublishedClimate Change White Paper_Published
Climate Change White Paper_Published
 
Chand, nazia
Chand, naziaChand, nazia
Chand, nazia
 
Effects of Yoga on Clinical Blood Pressure
Effects of Yoga on Clinical Blood PressureEffects of Yoga on Clinical Blood Pressure
Effects of Yoga on Clinical Blood Pressure
 
Gleichschaltung
GleichschaltungGleichschaltung
Gleichschaltung
 
Nazi opposition
Nazi oppositionNazi opposition
Nazi opposition
 
ICX Workshop - Quality Experiences for the Summer
ICX Workshop - Quality Experiences for the SummerICX Workshop - Quality Experiences for the Summer
ICX Workshop - Quality Experiences for the Summer
 
Presentation on samsung
Presentation on samsungPresentation on samsung
Presentation on samsung
 
Insidious Clip Analysis
Insidious Clip AnalysisInsidious Clip Analysis
Insidious Clip Analysis
 
Presentation on kitkat
Presentation on kitkatPresentation on kitkat
Presentation on kitkat
 
Glycated haemoglobin ppt by Basalingappa BG
Glycated haemoglobin ppt by Basalingappa BGGlycated haemoglobin ppt by Basalingappa BG
Glycated haemoglobin ppt by Basalingappa BG
 
Marketing customer flow (AIESEC)
Marketing customer flow (AIESEC)Marketing customer flow (AIESEC)
Marketing customer flow (AIESEC)
 

Semelhante a go generate pipeliner

How to build and distribute CLI tool in 15 minutes with Golang
How to build and distribute CLI tool in 15 minutes with GolangHow to build and distribute CLI tool in 15 minutes with Golang
How to build and distribute CLI tool in 15 minutes with Golang
Kohei Kimura
 
An Introduction to Go
An Introduction to GoAn Introduction to Go
An Introduction to Go
Cloudflare
 
[artifactconf] Github for People Who Don't Code
[artifactconf] Github for People Who Don't Code[artifactconf] Github for People Who Don't Code
[artifactconf] Github for People Who Don't Code
Christopher Schmitt
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014
Mandi Walls
 
How to stay sane during your Vagrant journey
How to stay sane during your Vagrant journeyHow to stay sane during your Vagrant journey
How to stay sane during your Vagrant journey
Jakub Wadolowski
 
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Mandi Walls
 
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison DowdneySetting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Weaveworks
 
Python to go
Python to goPython to go
Python to go
Weng Wei
 

Semelhante a go generate pipeliner (20)

Getting Started with Go
Getting Started with GoGetting Started with Go
Getting Started with Go
 
CPAN 模組二三事
CPAN 模組二三事CPAN 模組二三事
CPAN 模組二三事
 
Kubeflow Development Environment
Kubeflow Development EnvironmentKubeflow Development Environment
Kubeflow Development Environment
 
How to build and distribute CLI tool in 15 minutes with Golang
How to build and distribute CLI tool in 15 minutes with GolangHow to build and distribute CLI tool in 15 minutes with Golang
How to build and distribute CLI tool in 15 minutes with Golang
 
My Git workflow
My Git workflowMy Git workflow
My Git workflow
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflow
 
An Introduction to Go
An Introduction to GoAn Introduction to Go
An Introduction to Go
 
[artifactconf] Github for People Who Don't Code
[artifactconf] Github for People Who Don't Code[artifactconf] Github for People Who Don't Code
[artifactconf] Github for People Who Don't Code
 
Why my Go program is slow?
Why my Go program is slow?Why my Go program is slow?
Why my Go program is slow?
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014
 
How to stay sane during your Vagrant journey
How to stay sane during your Vagrant journeyHow to stay sane during your Vagrant journey
How to stay sane during your Vagrant journey
 
Hacking on WildFly 9
Hacking on WildFly 9Hacking on WildFly 9
Hacking on WildFly 9
 
ConcourseCi overview
ConcourseCi  overviewConcourseCi  overview
ConcourseCi overview
 
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
Updated non-lab version of Level Up. Delivered at LOPSA-East, May 3, 2014.
 
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison DowdneySetting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
 
runC – Open Container Initiative
runC – Open Container InitiativerunC – Open Container Initiative
runC – Open Container Initiative
 
Hands-on go profiling
Hands-on go profilingHands-on go profiling
Hands-on go profiling
 
Apache development with GitHub and Travis CI
Apache development with GitHub and Travis CIApache development with GitHub and Travis CI
Apache development with GitHub and Travis CI
 
Python to go
Python to goPython to go
Python to go
 

Último

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 

go generate pipeliner