SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Implementing a
command line client to
GitHub in Go
Owen Ou
@JingwenOwenOu
Agenda
• Automating Git/GitHub workflows with gh
• Introduction to Go
• What I learnt from implementing gh with
Go
What’s gh?
• a command line tool that makes working
with GitHub easier
• gh pull
• gh ci
• gh fork
• etc.
A broken workflow
• git checkout -b new_feature
• some code changes...
• git add .
• git commit -m “A comment”
• git push origin HEAD
• check CI status, oops..context switch
• create a pull request, oops...context switch
An optimized workflow
• git checkout -b new_feature
• some code changes...
• git add .
• git commit -m “A comment”
• git push origin HEAD
• gh ci # prints build status
• gh pull # creates a pull request
Demo
Implementation of gh
• Implemented in Go
• Fast (40% faster than Hub)
• A single, statically linked binary with no
dependencies (noVM needed!)
• Unix, e.g., gh pull -b integration -h
new_feature
What’s Go?
• Imperative
• Object-oriented like
• Concurrent
• Compile to machine code
• Created at 2009, v1.1.1
Ken Thompson
• Founding father of Unix, see
“Coders at work”
• Bring in regular expression
to computing
• Created grep in an evening
• Designed UTF-8 on a diner
placemat
Robert Griesemer
• Native code generation for
V8
• Java HotSpotVM
• StrongtalkVM (inspires the
DartVM)
Rob Pike
• First window system for
Unix at Bell Labs
• Plan 9
• Co-Authors of “The Unix
Programming Environment”
& “The Practice of
Programming” with Brian
Kernighan
• Newsqueak, Limbo:
implementations of Tony
Hoare’s CSP
Why Go?
• Why Learn Go? An interview with Rob
Pike: http://www.youtube.com/watch?
v=FTl0tl9BGdc
Hello Go
More about Go
• Compilation is very fast, gh has 1581 LOC,
the build time is 0.77s
• Static typing & type inference
• Low level primitives uint, float64
• Garbage collected
• Pointers without pointer arithmetic
Interfaces
The C10K Problem
• The problem of optimizing socket server
software to handle a large number of
clients at the same time
• C10k = concurrent ten thousand
connections
• Linux pthreads (8MB),Windows (1MB),
Coroutines (4k, e.g., Ruby Fibers)
Goroutines
• Coroutines in Go, 4K, light weight threads
• Segmented stacks (a double linked lists)
• No stack-overflow
• Automatically scale to multiple-cores
• In the future, scale to multiple machines
Goroutines
Channels
Learning from gh
• Right tool for the job - building a Unix tool
• Go’s compiler is freaking fast!
• Clarity and simplicity, less is more
• Go fmt
• Fast startup time, low memory usage
• Deploy a static library (making deployment so
much simpler!)
• Goroutines & channels (higher level APIs in net/
http)
References
• gh: https://github.com/jingweno/gh
• Code examples: https://gist.github.com/
jingweno/c00e973ade6d66b827fd
• Go at Google: http://www.infoq.com/
presentations/Go-Google
• Concurrency is not Parallelism: http://
vimeo.com/49718712
• Real world Go: https://gist.github.com/
ungerik/3731476
Q&A

Weitere ähnliche Inhalte

Was ist angesagt?

Infrastructure as "Code" with Pulumi
Infrastructure as "Code" with PulumiInfrastructure as "Code" with Pulumi
Infrastructure as "Code" with PulumiVenura Athukorala
 
Developing Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptDeveloping Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptnohuhu
 
Celery
CeleryCelery
CeleryYipit
 
Continuous deployment of Rails apps on AWS OpsWorks
Continuous deployment of Rails apps on AWS OpsWorksContinuous deployment of Rails apps on AWS OpsWorks
Continuous deployment of Rails apps on AWS OpsWorksTomaž Zaman
 
Infrastructure-as-Code with Pulumi - Better than all the others (like Ansible)?
Infrastructure-as-Code with Pulumi- Better than all the others (like Ansible)?Infrastructure-as-Code with Pulumi- Better than all the others (like Ansible)?
Infrastructure-as-Code with Pulumi - Better than all the others (like Ansible)?Jonas Hecht
 
Plone migrations using plone.restapi
Plone migrations using plone.restapiPlone migrations using plone.restapi
Plone migrations using plone.restapiAndreas Jung
 
Plone 5.2 migration at University Ghent, Belgium
Plone 5.2 migration at University Ghent, BelgiumPlone 5.2 migration at University Ghent, Belgium
Plone 5.2 migration at University Ghent, BelgiumAndreas Jung
 
So you want to write a cloud function
So you want to write a cloud functionSo you want to write a cloud function
So you want to write a cloud functionElad Hirsch
 
.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло Голубович.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло ГолубовичSigma Software
 
Asynchronous job queues with python-rq
Asynchronous job queues with python-rqAsynchronous job queues with python-rq
Asynchronous job queues with python-rqAshish Acharya
 
Embracing Serverless with Google
Embracing Serverless with GoogleEmbracing Serverless with Google
Embracing Serverless with GoogleJoseph Lust
 
Amsterdam Meetup Presentation - Marts 2014
Amsterdam Meetup Presentation - Marts 2014Amsterdam Meetup Presentation - Marts 2014
Amsterdam Meetup Presentation - Marts 2014Mads Møller
 
Part 3 of the REAL Webinars on Oracle Cloud Native Application Development (J...
Part 3 of the REAL Webinars on Oracle Cloud Native Application Development (J...Part 3 of the REAL Webinars on Oracle Cloud Native Application Development (J...
Part 3 of the REAL Webinars on Oracle Cloud Native Application Development (J...Lucas Jellema
 
Apache Airflow Introduction
Apache Airflow IntroductionApache Airflow Introduction
Apache Airflow IntroductionLiangjun Jiang
 
Scaling application servers for efficiency
Scaling application servers for efficiencyScaling application servers for efficiency
Scaling application servers for efficiencyTomas Doran
 

Was ist angesagt? (20)

Apache Airflow
Apache AirflowApache Airflow
Apache Airflow
 
Infrastructure as "Code" with Pulumi
Infrastructure as "Code" with PulumiInfrastructure as "Code" with Pulumi
Infrastructure as "Code" with Pulumi
 
Developing Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptDeveloping Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScript
 
Celery
CeleryCelery
Celery
 
Continuous deployment of Rails apps on AWS OpsWorks
Continuous deployment of Rails apps on AWS OpsWorksContinuous deployment of Rails apps on AWS OpsWorks
Continuous deployment of Rails apps on AWS OpsWorks
 
Infrastructure-as-Code with Pulumi - Better than all the others (like Ansible)?
Infrastructure-as-Code with Pulumi- Better than all the others (like Ansible)?Infrastructure-as-Code with Pulumi- Better than all the others (like Ansible)?
Infrastructure-as-Code with Pulumi - Better than all the others (like Ansible)?
 
Plone migrations using plone.restapi
Plone migrations using plone.restapiPlone migrations using plone.restapi
Plone migrations using plone.restapi
 
Plone 5.2 migration at University Ghent, Belgium
Plone 5.2 migration at University Ghent, BelgiumPlone 5.2 migration at University Ghent, Belgium
Plone 5.2 migration at University Ghent, Belgium
 
PR workflow
PR workflowPR workflow
PR workflow
 
Git
GitGit
Git
 
So you want to write a cloud function
So you want to write a cloud functionSo you want to write a cloud function
So you want to write a cloud function
 
.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло Голубович.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло Голубович
 
Asynchronous job queues with python-rq
Asynchronous job queues with python-rqAsynchronous job queues with python-rq
Asynchronous job queues with python-rq
 
Embracing Serverless with Google
Embracing Serverless with GoogleEmbracing Serverless with Google
Embracing Serverless with Google
 
Amsterdam Meetup Presentation - Marts 2014
Amsterdam Meetup Presentation - Marts 2014Amsterdam Meetup Presentation - Marts 2014
Amsterdam Meetup Presentation - Marts 2014
 
Part 3 of the REAL Webinars on Oracle Cloud Native Application Development (J...
Part 3 of the REAL Webinars on Oracle Cloud Native Application Development (J...Part 3 of the REAL Webinars on Oracle Cloud Native Application Development (J...
Part 3 of the REAL Webinars on Oracle Cloud Native Application Development (J...
 
Pre-rendering single page app
Pre-rendering single page appPre-rendering single page app
Pre-rendering single page app
 
Apache Airflow Introduction
Apache Airflow IntroductionApache Airflow Introduction
Apache Airflow Introduction
 
Scaling application servers for efficiency
Scaling application servers for efficiencyScaling application servers for efficiency
Scaling application servers for efficiency
 
Celery workshop
Celery workshopCelery workshop
Celery workshop
 

Andere mochten auch

Doing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to ProductivityDoing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to Productivitykevinreiss
 
Dspace at CUNY
Dspace at CUNYDspace at CUNY
Dspace at CUNYkevinreiss
 
Improving DSpace Backups, Restores & Migrations
Improving DSpace Backups, Restores & MigrationsImproving DSpace Backups, Restores & Migrations
Improving DSpace Backups, Restores & MigrationsTim Donohue
 
Making DSpace XMLUI Your Own
Making DSpace XMLUI Your OwnMaking DSpace XMLUI Your Own
Making DSpace XMLUI Your OwnTim Donohue
 
DSpace 4.2 Basics & Configuration
DSpace 4.2 Basics & ConfigurationDSpace 4.2 Basics & Configuration
DSpace 4.2 Basics & ConfigurationDuraSpace
 

Andere mochten auch (6)

Doing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to ProductivityDoing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to Productivity
 
Dspace at CUNY
Dspace at CUNYDspace at CUNY
Dspace at CUNY
 
Improving DSpace Backups, Restores & Migrations
Improving DSpace Backups, Restores & MigrationsImproving DSpace Backups, Restores & Migrations
Improving DSpace Backups, Restores & Migrations
 
Dspace software
Dspace softwareDspace software
Dspace software
 
Making DSpace XMLUI Your Own
Making DSpace XMLUI Your OwnMaking DSpace XMLUI Your Own
Making DSpace XMLUI Your Own
 
DSpace 4.2 Basics & Configuration
DSpace 4.2 Basics & ConfigurationDSpace 4.2 Basics & Configuration
DSpace 4.2 Basics & Configuration
 

Ähnlich wie Implementing a command line client to GitHub in Go with Go

Python to go
Python to goPython to go
Python to goWeng Wei
 
Jenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
Jenkins-Koji plugin presentation on Python & Ruby devel group @ BrnoJenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
Jenkins-Koji plugin presentation on Python & Ruby devel group @ BrnoVaclav Tunka
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIsTim Osborn
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network EngineersJoel W. King
 
Infrastructure, Hiphop for PHP, deploy @ Hyves
Infrastructure, Hiphop for PHP, deploy @ HyvesInfrastructure, Hiphop for PHP, deploy @ Hyves
Infrastructure, Hiphop for PHP, deploy @ HyvesMarco Londero
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubBigBlueHat
 
Go: What's Different ?
Go: What's Different ?Go: What's Different ?
Go: What's Different ?Tarun Vashisth
 
State of NuPIC
State of NuPICState of NuPIC
State of NuPICNumenta
 
Progressive Enhancement using WSGI
Progressive Enhancement using WSGIProgressive Enhancement using WSGI
Progressive Enhancement using WSGIMatthew Wilkes
 
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 Puppet
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflowTomas Doran
 
orlando-codecamp-meet-copilot-24-Feb-2024_pub.pptx
orlando-codecamp-meet-copilot-24-Feb-2024_pub.pptxorlando-codecamp-meet-copilot-24-Feb-2024_pub.pptx
orlando-codecamp-meet-copilot-24-Feb-2024_pub.pptxBill Wilder
 
Why my Go program is slow?
Why my Go program is slow?Why my Go program is slow?
Why my Go program is slow?Inada Naoki
 
Fission Introduction
Fission IntroductionFission Introduction
Fission IntroductionTa Ching Chen
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Derek Jacoby
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2Derek Jacoby
 
Codifying the Build and Release Process with a Jenkins Pipeline Shared Library
Codifying the Build and Release Process with a Jenkins Pipeline Shared LibraryCodifying the Build and Release Process with a Jenkins Pipeline Shared Library
Codifying the Build and Release Process with a Jenkins Pipeline Shared LibraryAlvin Huang
 

Ähnlich wie Implementing a command line client to GitHub in Go with Go (20)

Python to go
Python to goPython to go
Python to go
 
Jenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
Jenkins-Koji plugin presentation on Python & Ruby devel group @ BrnoJenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
Jenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network Engineers
 
Infrastructure, Hiphop for PHP, deploy @ Hyves
Infrastructure, Hiphop for PHP, deploy @ HyvesInfrastructure, Hiphop for PHP, deploy @ Hyves
Infrastructure, Hiphop for PHP, deploy @ Hyves
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
Go: What's Different ?
Go: What's Different ?Go: What's Different ?
Go: What's Different ?
 
State of NuPIC
State of NuPICState of NuPIC
State of NuPIC
 
Progressive Enhancement using WSGI
Progressive Enhancement using WSGIProgressive Enhancement using WSGI
Progressive Enhancement using WSGI
 
cadec-2017-golang
cadec-2017-golangcadec-2017-golang
cadec-2017-golang
 
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
 
PySide
PySidePySide
PySide
 
orlando-codecamp-meet-copilot-24-Feb-2024_pub.pptx
orlando-codecamp-meet-copilot-24-Feb-2024_pub.pptxorlando-codecamp-meet-copilot-24-Feb-2024_pub.pptx
orlando-codecamp-meet-copilot-24-Feb-2024_pub.pptx
 
Why my Go program is slow?
Why my Go program is slow?Why my Go program is slow?
Why my Go program is slow?
 
Fission Introduction
Fission IntroductionFission Introduction
Fission Introduction
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 
C og c++-jens lund jensen
C og c++-jens lund jensenC og c++-jens lund jensen
C og c++-jens lund jensen
 
Codifying the Build and Release Process with a Jenkins Pipeline Shared Library
Codifying the Build and Release Process with a Jenkins Pipeline Shared LibraryCodifying the Build and Release Process with a Jenkins Pipeline Shared Library
Codifying the Build and Release Process with a Jenkins Pipeline Shared Library
 

Kürzlich hochgeladen

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 

Kürzlich hochgeladen (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 

Implementing a command line client to GitHub in Go with Go

  • 1. Implementing a command line client to GitHub in Go Owen Ou @JingwenOwenOu
  • 2. Agenda • Automating Git/GitHub workflows with gh • Introduction to Go • What I learnt from implementing gh with Go
  • 3. What’s gh? • a command line tool that makes working with GitHub easier • gh pull • gh ci • gh fork • etc.
  • 4. A broken workflow • git checkout -b new_feature • some code changes... • git add . • git commit -m “A comment” • git push origin HEAD • check CI status, oops..context switch • create a pull request, oops...context switch
  • 5. An optimized workflow • git checkout -b new_feature • some code changes... • git add . • git commit -m “A comment” • git push origin HEAD • gh ci # prints build status • gh pull # creates a pull request
  • 7. Implementation of gh • Implemented in Go • Fast (40% faster than Hub) • A single, statically linked binary with no dependencies (noVM needed!) • Unix, e.g., gh pull -b integration -h new_feature
  • 8. What’s Go? • Imperative • Object-oriented like • Concurrent • Compile to machine code • Created at 2009, v1.1.1
  • 9. Ken Thompson • Founding father of Unix, see “Coders at work” • Bring in regular expression to computing • Created grep in an evening • Designed UTF-8 on a diner placemat
  • 10. Robert Griesemer • Native code generation for V8 • Java HotSpotVM • StrongtalkVM (inspires the DartVM)
  • 11. Rob Pike • First window system for Unix at Bell Labs • Plan 9 • Co-Authors of “The Unix Programming Environment” & “The Practice of Programming” with Brian Kernighan • Newsqueak, Limbo: implementations of Tony Hoare’s CSP
  • 12. Why Go? • Why Learn Go? An interview with Rob Pike: http://www.youtube.com/watch? v=FTl0tl9BGdc
  • 14. More about Go • Compilation is very fast, gh has 1581 LOC, the build time is 0.77s • Static typing & type inference • Low level primitives uint, float64 • Garbage collected • Pointers without pointer arithmetic
  • 16. The C10K Problem • The problem of optimizing socket server software to handle a large number of clients at the same time • C10k = concurrent ten thousand connections • Linux pthreads (8MB),Windows (1MB), Coroutines (4k, e.g., Ruby Fibers)
  • 17. Goroutines • Coroutines in Go, 4K, light weight threads • Segmented stacks (a double linked lists) • No stack-overflow • Automatically scale to multiple-cores • In the future, scale to multiple machines
  • 20. Learning from gh • Right tool for the job - building a Unix tool • Go’s compiler is freaking fast! • Clarity and simplicity, less is more • Go fmt • Fast startup time, low memory usage • Deploy a static library (making deployment so much simpler!) • Goroutines & channels (higher level APIs in net/ http)
  • 21. References • gh: https://github.com/jingweno/gh • Code examples: https://gist.github.com/ jingweno/c00e973ade6d66b827fd • Go at Google: http://www.infoq.com/ presentations/Go-Google • Concurrency is not Parallelism: http:// vimeo.com/49718712 • Real world Go: https://gist.github.com/ ungerik/3731476
  • 22. Q&A