SlideShare a Scribd company logo
1 of 22
Download to read offline
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

More Related Content

What's hot

What's hot (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
 

Viewers also liked

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
 

Viewers also liked (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
 

Similar to Building Command Line Tools with Golang

Similar to 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
 

Recently uploaded

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Recently uploaded (20)

%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
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
 
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
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
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...
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 

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