SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Building Command
Line Tools
with Golang
Takaaki Mizuno
Innovatube TechTalk #3
Who Am I
Takaaki Mizuno
CEO of Innovatube Solutions
19 years experience as software developer
34 years experience in coding
Still coding
Based in Singapore
Japanese born in Japan
Published 20+ technical books in Japan
Golang Use Cases
Golang at Innovatube
We selected 2 primary languages for web/mobile-app back-end
development.
PHP
Golang
Golang is used for non-HTML-Heavy Web development
API Server for Mobile Apps
Use React on Frontend and backend system only returns
structured data such as JSON
Golang Use Cases
Web Services
Mobile Applications ( Android [ver 1.4~] / iOS [ver 1.5~])
Game Backend
Daemon / Service
Command Line Tools
Golang and Command
Line Tools
Which Language Are You Using
For Writing Command Line Tools ?
Node.js
Java
Python
Ruby
C++
Golang
Which language should we
use for command line tools?
It depends on the use case of the tool.
If the tool is dedicated for specific languages/framework, use that languages.
Ruby for rubygems
PHP for composer
Node.js for front-end task runners ( gulp / grunt )
It the tool is a part of a project, you should use same language
Java for Java project
Python for Python project
Other cases
Use Golang
Benefit for Command Line
Tools
Single Binary
Cross Platform ( Can support Windows easily )
No run-time dependencies
Concurrency
Many famous “command line”
tools are written in Golang
docker
Terraform ( By Hashicorp)
hub ( by GitHub )
Write command line
tools in Golang
Many Libraries You Can Use
Standard CLI
Libraries for building standard or basic Command Line applications
cli - A feature-rich and easy to use command-line package based on golang tag
cli-init - The easy way to start building Golang command line application.
climax - An alternative CLI with "human face", in spirit of Go command
cobra - A Commander for modern Go CLI interactions
codegangsta/cli - A small package for building command line apps in Go.
docopt.go - A command-line arguments parser that will make you smile.
go-flags - go command line option parser
kingpin - A command line and flag parser supporting sub commands.
liner - A Go readline-like library for command-line interfaces.
mitchellh/cli - A Go library for implementing command-line interfaces.
mow.cli - A Go library for building CLI applications with sophisticated flag and argument parsing and validation.
From: Awesome-go ( https://github.com/avelino/awesome-go#command-line )
You can use “gcli”
It generates a skeleton (codes and its directory
structure) you need to start building Command Line
Interface (CLI) tool
https://github.com/tcnksm/gcli
Easy To Use
gcli new -command=init -command=get -owner=takaaki-mizuno awesomecommand
% awesomecommand init
DEMO
Support 4 CLI libraries
+-----------------+---------+-----------------------------------------------------+
| NAME | COMMAND | URL |
+-----------------+---------+-----------------------------------------------------+
| mitchellh_cli | * | https://github.com/mitchellh/cli |
| codegangsta_cli | * | https://github.com/codegangsta/cli |
| go_cmd | * | https://github.com/golang/go/tree/master/src/cmd/go |
| flag | | https://golang.org/pkg/flag/ |
+-----------------+---------+-----------------------------------------------------+
% gcli list
Some Tips For Golang
( command line tools )
Text Colorize
mgutz/ansi & mattn/go-colorable
mgutz/ansi is a library to create ANSI colored strings
and codes
mattn/go-colorable is an io.Writer wrapper to support
Windows DOS prompt colorize
Building Dashboard
gizak/termui
Can build Text Base Dashboard with GUI Building-
Like APIs
Happy Coding!
We are Hiring!
You want to write Golang ?
Join us !
http://innovatube.com/
Q & A

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Come With Golang
Come With GolangCome With Golang
Come With Golang
 
Wonders of Golang
Wonders of GolangWonders of Golang
Wonders of Golang
 
welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?
 
Golang online course
Golang online courseGolang online course
Golang online course
 
Golang for PHP programmers: A practical introduction
Golang for PHP programmers: A practical introductionGolang for PHP programmers: A practical introduction
Golang for PHP programmers: A practical introduction
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
Golang start and tips
Golang start and tipsGolang start and tips
Golang start and tips
 
Why you should care about Go (Golang)
Why you should care about Go (Golang)Why you should care about Go (Golang)
Why you should care about Go (Golang)
 
Dependency management in golang
Dependency management in golangDependency management in golang
Dependency management in golang
 
Getting started with Go - Florin Patan - Codemotion Rome 2017
Getting started with Go - Florin Patan - Codemotion Rome 2017Getting started with Go - Florin Patan - Codemotion Rome 2017
Getting started with Go - Florin Patan - Codemotion Rome 2017
 
Golang
GolangGolang
Golang
 
A First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageA First Look at Google's Go Programming Language
A First Look at Google's Go Programming Language
 
13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications
 
Go from PHP engineer's perspective
Go from PHP engineer's perspectiveGo from PHP engineer's perspective
Go from PHP engineer's perspective
 
Go lang
Go langGo lang
Go lang
 
Introduction to Go-Lang
Introduction to Go-LangIntroduction to Go-Lang
Introduction to Go-Lang
 
The Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventure
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
(Live) build and run golang web server on android.avi
(Live) build and run golang web server on android.avi(Live) build and run golang web server on android.avi
(Live) build and run golang web server on android.avi
 
Coding with golang
Coding with golangCoding with golang
Coding with golang
 

Andere mochten auch

Example Of Experience
Example Of ExperienceExample Of Experience
Example Of Experience
Luis_Lavieri
 
Tutorial Staad-Pro
Tutorial Staad-ProTutorial Staad-Pro
Tutorial Staad-Pro
Nabeh Wildan
 

Andere mochten auch (16)

Golang concurrency design
Golang concurrency designGolang concurrency design
Golang concurrency design
 
Concurrency in Golang
Concurrency in GolangConcurrency in Golang
Concurrency in Golang
 
High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014
 
Going All-In With Go For CLI Apps
Going All-In With Go For CLI AppsGoing All-In With Go For CLI Apps
Going All-In With Go For CLI Apps
 
Golang vs Ruby
Golang vs RubyGolang vs Ruby
Golang vs Ruby
 
Golang #5: To Go or not to Go
Golang #5: To Go or not to GoGolang #5: To Go or not to Go
Golang #5: To Go or not to Go
 
Example Of Experience
Example Of ExperienceExample Of Experience
Example Of Experience
 
hacking with node.JS
hacking with node.JShacking with node.JS
hacking with node.JS
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxGo debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFx
 
Important Comment used in AutoCAD 2D Khmer Guide
Important Comment used in AutoCAD 2D Khmer Guide Important Comment used in AutoCAD 2D Khmer Guide
Important Comment used in AutoCAD 2D Khmer Guide
 
Most Essential AutoCAD Commands
Most Essential AutoCAD CommandsMost Essential AutoCAD Commands
Most Essential AutoCAD Commands
 
Staadpresentation1 159
Staadpresentation1 159Staadpresentation1 159
Staadpresentation1 159
 
Staad pro
Staad proStaad pro
Staad pro
 
Tutorial Staad-Pro
Tutorial Staad-ProTutorial Staad-Pro
Tutorial Staad-Pro
 
DESIGN AND ANALAYSIS OF MULTI STOREY BUILDING USING STAAD PRO
DESIGN AND ANALAYSIS OF MULTI STOREY BUILDING USING STAAD PRODESIGN AND ANALAYSIS OF MULTI STOREY BUILDING USING STAAD PRO
DESIGN AND ANALAYSIS OF MULTI STOREY BUILDING USING STAAD PRO
 
Final ppt on staad pro
Final ppt on staad proFinal ppt on staad pro
Final ppt on staad pro
 

Ähnlich wie Building Command Line Tools with Golang

Ähnlich wie Building Command Line Tools with Golang (20)

Advantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworksAdvantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworks
 
Introduction to Application Development in Python and Gtk+ / Hildon @ Maemo 5
Introduction to Application Development in Python and Gtk+ / Hildon @ Maemo 5Introduction to Application Development in Python and Gtk+ / Hildon @ Maemo 5
Introduction to Application Development in Python and Gtk+ / Hildon @ Maemo 5
 
When, how & why use golang in 2021 go benefits & use cases
When, how & why use golang in 2021  go benefits & use casesWhen, how & why use golang in 2021  go benefits & use cases
When, how & why use golang in 2021 go benefits & use cases
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
 
Golang job support.pptx
Golang job support.pptxGolang job support.pptx
Golang job support.pptx
 
Golang web development
Golang web developmentGolang web development
Golang web development
 
Hire golang developers and make the shift to brighter business future (build ...
Hire golang developers and make the shift to brighter business future (build ...Hire golang developers and make the shift to brighter business future (build ...
Hire golang developers and make the shift to brighter business future (build ...
 
Let's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming LanguageLet's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming Language
 
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language
 
Golang : A Hype or the Future?
Golang : A Hype or the Future?Golang : A Hype or the Future?
Golang : A Hype or the Future?
 
The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180
 
Golang Vs NodeJS: Which One To Choose For Your 2023
Golang Vs NodeJS: Which One To Choose For Your 2023Golang Vs NodeJS: Which One To Choose For Your 2023
Golang Vs NodeJS: Which One To Choose For Your 2023
 
The Ring programming language version 1.2 book - Part 4 of 84
The Ring programming language version 1.2 book - Part 4 of 84The Ring programming language version 1.2 book - Part 4 of 84
The Ring programming language version 1.2 book - Part 4 of 84
 
Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016
 
Node.Js Vs Golang.pdf
Node.Js Vs Golang.pdfNode.Js Vs Golang.pdf
Node.Js Vs Golang.pdf
 
Ultimate golang performance optimization guide
Ultimate golang performance optimization guide Ultimate golang performance optimization guide
Ultimate golang performance optimization guide
 
The Ring programming language version 1.5.2 book - Part 5 of 181
The Ring programming language version 1.5.2 book - Part 5 of 181The Ring programming language version 1.5.2 book - Part 5 of 181
The Ring programming language version 1.5.2 book - Part 5 of 181
 
The Ring programming language version 1.5.3 book - Part 5 of 184
The Ring programming language version 1.5.3 book - Part 5 of 184The Ring programming language version 1.5.3 book - Part 5 of 184
The Ring programming language version 1.5.3 book - Part 5 of 184
 
Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
 
The Ring programming language version 1.5.4 book - Part 5 of 185
The Ring programming language version 1.5.4 book - Part 5 of 185The Ring programming language version 1.5.4 book - Part 5 of 185
The Ring programming language version 1.5.4 book - Part 5 of 185
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
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
 

Kürzlich hochgeladen (20)

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
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...
 
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
 
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
 
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
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
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
 
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
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
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
 
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
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
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 🔝✔️✔️
 

Building Command Line Tools with Golang

  • 1. Building Command Line Tools with Golang Takaaki Mizuno Innovatube TechTalk #3
  • 2. Who Am I Takaaki Mizuno CEO of Innovatube Solutions 19 years experience as software developer 34 years experience in coding Still coding Based in Singapore Japanese born in Japan Published 20+ technical books in Japan
  • 4. Golang at Innovatube We selected 2 primary languages for web/mobile-app back-end development. PHP Golang Golang is used for non-HTML-Heavy Web development API Server for Mobile Apps Use React on Frontend and backend system only returns structured data such as JSON
  • 5. Golang Use Cases Web Services Mobile Applications ( Android [ver 1.4~] / iOS [ver 1.5~]) Game Backend Daemon / Service Command Line Tools
  • 7. Which Language Are You Using For Writing Command Line Tools ? Node.js Java Python Ruby C++ Golang
  • 8. Which language should we use for command line tools? It depends on the use case of the tool. If the tool is dedicated for specific languages/framework, use that languages. Ruby for rubygems PHP for composer Node.js for front-end task runners ( gulp / grunt ) It the tool is a part of a project, you should use same language Java for Java project Python for Python project Other cases Use Golang
  • 9. Benefit for Command Line Tools Single Binary Cross Platform ( Can support Windows easily ) No run-time dependencies Concurrency
  • 10. Many famous “command line” tools are written in Golang docker Terraform ( By Hashicorp) hub ( by GitHub )
  • 12. Many Libraries You Can Use Standard CLI Libraries for building standard or basic Command Line applications cli - A feature-rich and easy to use command-line package based on golang tag cli-init - The easy way to start building Golang command line application. climax - An alternative CLI with "human face", in spirit of Go command cobra - A Commander for modern Go CLI interactions codegangsta/cli - A small package for building command line apps in Go. docopt.go - A command-line arguments parser that will make you smile. go-flags - go command line option parser kingpin - A command line and flag parser supporting sub commands. liner - A Go readline-like library for command-line interfaces. mitchellh/cli - A Go library for implementing command-line interfaces. mow.cli - A Go library for building CLI applications with sophisticated flag and argument parsing and validation. From: Awesome-go ( https://github.com/avelino/awesome-go#command-line )
  • 13. You can use “gcli” It generates a skeleton (codes and its directory structure) you need to start building Command Line Interface (CLI) tool https://github.com/tcnksm/gcli
  • 14. Easy To Use gcli new -command=init -command=get -owner=takaaki-mizuno awesomecommand % awesomecommand init
  • 15. DEMO
  • 16. Support 4 CLI libraries +-----------------+---------+-----------------------------------------------------+ | NAME | COMMAND | URL | +-----------------+---------+-----------------------------------------------------+ | mitchellh_cli | * | https://github.com/mitchellh/cli | | codegangsta_cli | * | https://github.com/codegangsta/cli | | go_cmd | * | https://github.com/golang/go/tree/master/src/cmd/go | | flag | | https://golang.org/pkg/flag/ | +-----------------+---------+-----------------------------------------------------+ % gcli list
  • 17. Some Tips For Golang ( command line tools )
  • 18. Text Colorize mgutz/ansi & mattn/go-colorable mgutz/ansi is a library to create ANSI colored strings and codes mattn/go-colorable is an io.Writer wrapper to support Windows DOS prompt colorize
  • 19. Building Dashboard gizak/termui Can build Text Base Dashboard with GUI Building- Like APIs
  • 21. We are Hiring! You want to write Golang ? Join us ! http://innovatube.com/
  • 22. Q & A