SlideShare a Scribd company logo
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

PDF
[INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno
Nexus FrontierTech
 
PPTX
Developing Cross Platform Applications with Golang
Erhan Yakut
 
PPTX
Golang Channels use cases
Erhan Yakut
 
PDF
[INNOVATUBE] Tech Talk #3: Golang - Vũ Nguyễn
Nexus FrontierTech
 
PDF
Golang from Scala developer’s perspective
Sveta Bozhko
 
PDF
GoLang Introduction
Spandana Govindgari
 
PPTX
Optimizing and Profiling Golang Rest Api
Iman Syahputra Situmorang
 
[INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno
Nexus FrontierTech
 
Developing Cross Platform Applications with Golang
Erhan Yakut
 
Golang Channels use cases
Erhan Yakut
 
[INNOVATUBE] Tech Talk #3: Golang - Vũ Nguyễn
Nexus FrontierTech
 
Golang from Scala developer’s perspective
Sveta Bozhko
 
GoLang Introduction
Spandana Govindgari
 
Optimizing and Profiling Golang Rest Api
Iman Syahputra Situmorang
 

What's hot (20)

PPT
Come With Golang
尚文 曾
 
PPTX
Wonders of Golang
Kartik Sura
 
PDF
welcome to gopherlabs - why go (golang)?
sangam biradar
 
PDF
Golang online course
bestonlinecoursescoupon
 
PDF
Golang for PHP programmers: A practical introduction
Richard Tuin
 
PPTX
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
PPTX
Golang start and tips
Aaron King
 
PDF
Why you should care about Go (Golang)
Aaron Schlesinger
 
PDF
Dependency management in golang
Ramit Surana
 
PDF
Getting started with Go - Florin Patan - Codemotion Rome 2017
Codemotion
 
PPTX
Golang
Michael Blake
 
PPT
A First Look at Google's Go Programming Language
Ganesh Samarthyam
 
PDF
13 practical tips for writing secure golang applications
Karthik Gaekwad
 
PDF
Go from PHP engineer's perspective
Sobit Akhmedov
 
PDF
Go lang
Suelen Carvalho
 
PPT
Introduction to Go-Lang
Folio3 Software
 
PDF
The Go programming language - Intro by MyLittleAdventure
mylittleadventure
 
PPTX
Introduction to go lang
Amal Mohan N
 
PDF
(Live) build and run golang web server on android.avi
SeongJae Park
 
PDF
Coding with golang
HannahMoss14
 
Come With Golang
尚文 曾
 
Wonders of Golang
Kartik Sura
 
welcome to gopherlabs - why go (golang)?
sangam biradar
 
Golang online course
bestonlinecoursescoupon
 
Golang for PHP programmers: A practical introduction
Richard Tuin
 
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
Golang start and tips
Aaron King
 
Why you should care about Go (Golang)
Aaron Schlesinger
 
Dependency management in golang
Ramit Surana
 
Getting started with Go - Florin Patan - Codemotion Rome 2017
Codemotion
 
A First Look at Google's Go Programming Language
Ganesh Samarthyam
 
13 practical tips for writing secure golang applications
Karthik Gaekwad
 
Go from PHP engineer's perspective
Sobit Akhmedov
 
Introduction to Go-Lang
Folio3 Software
 
The Go programming language - Intro by MyLittleAdventure
mylittleadventure
 
Introduction to go lang
Amal Mohan N
 
(Live) build and run golang web server on android.avi
SeongJae Park
 
Coding with golang
HannahMoss14
 
Ad

Viewers also liked (16)

PDF
Golang concurrency design
Hyejong
 
PDF
Concurrency in Golang
Oliver N
 
PDF
High productivity web development workflow - JavaScript Meetup Saigon 2014
Oliver N
 
PDF
Going All-In With Go For CLI Apps
Tom Elliott
 
PDF
Golang vs Ruby
Michał Konarski
 
PDF
Golang #5: To Go or not to Go
Oliver N
 
PPTX
Example Of Experience
Luis_Lavieri
 
PPTX
hacking with node.JS
Harsha Vashisht
 
PDF
Go debugging and troubleshooting tips - from real life lessons at SignalFx
SignalFx
 
PDF
Important Comment used in AutoCAD 2D Khmer Guide
Thim Mengly(ម៉េងលី,孟李)
 
PDF
Most Essential AutoCAD Commands
Ravi Bhadauria
 
PPT
Staadpresentation1 159
AHMED NADIM JILANI
 
PPSX
Staad pro
Radhakrishnan Ramkumar
 
PDF
Tutorial Staad-Pro
Nabeh Wildan
 
PPTX
DESIGN AND ANALAYSIS OF MULTI STOREY BUILDING USING STAAD PRO
Ali Meer
 
PPTX
Final ppt on staad pro
Sakina Faiz
 
Golang concurrency design
Hyejong
 
Concurrency in Golang
Oliver N
 
High productivity web development workflow - JavaScript Meetup Saigon 2014
Oliver N
 
Going All-In With Go For CLI Apps
Tom Elliott
 
Golang vs Ruby
Michał Konarski
 
Golang #5: To Go or not to Go
Oliver N
 
Example Of Experience
Luis_Lavieri
 
hacking with node.JS
Harsha Vashisht
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
SignalFx
 
Important Comment used in AutoCAD 2D Khmer Guide
Thim Mengly(ម៉េងលី,孟李)
 
Most Essential AutoCAD Commands
Ravi Bhadauria
 
Staadpresentation1 159
AHMED NADIM JILANI
 
Tutorial Staad-Pro
Nabeh Wildan
 
DESIGN AND ANALAYSIS OF MULTI STOREY BUILDING USING STAAD PRO
Ali Meer
 
Final ppt on staad pro
Sakina Faiz
 
Ad

Similar to Building Command Line Tools with Golang (20)

PPTX
Building CLI Applications with Golang
Anshul Patel
 
PDF
Building Awesome CLI apps in Go
Steven Francia
 
PDF
How to build and distribute CLI tool in 15 minutes with Golang
Kohei Kimura
 
PDF
Getting Started with Go
Steven Francia
 
PDF
Introduction to Go
Simon Hewitt
 
PPTX
Ready, set, go! An introduction to the Go programming language
RTigger
 
PDF
Writing Rust Command Line Applications
All Things Open
 
PDF
Happy Go Programming Part 1
Lin Yo-An
 
PDF
A gentle intro to Golang and the Go-universe
Alex-P. Natsios
 
PDF
Golang workshop
Victor S. Recio
 
PDF
Docker and Go: why did we decide to write Docker in Go?
Jérôme Petazzoni
 
PDF
Golang_Perl_Doc
Supreet Sethi
 
PPTX
The GO Language : From Beginners to Gophers
I.I.S. G. Vallauri - Fossano
 
PDF
Go for SysAdmins - LISA 2015
Chris McEniry
 
PDF
Building robust and friendly command line applications in go
Andrii Soldatenko
 
PDF
Import golang; struct microservice
Giulio De Donato
 
PPTX
Ndc2017
Ken Faulkner
 
PDF
OSCON2014 : Quick Introduction to System Tools Programming with Go
Chris McEniry
 
PDF
Java to Golang: An intro by Ryan Dawson Seldon.io
Mauricio (Salaboy) Salatino
 
PDF
The Go features I can't live without, 2nd round
Rodolfo Carvalho
 
Building CLI Applications with Golang
Anshul Patel
 
Building Awesome CLI apps in Go
Steven Francia
 
How to build and distribute CLI tool in 15 minutes with Golang
Kohei Kimura
 
Getting Started with Go
Steven Francia
 
Introduction to Go
Simon Hewitt
 
Ready, set, go! An introduction to the Go programming language
RTigger
 
Writing Rust Command Line Applications
All Things Open
 
Happy Go Programming Part 1
Lin Yo-An
 
A gentle intro to Golang and the Go-universe
Alex-P. Natsios
 
Golang workshop
Victor S. Recio
 
Docker and Go: why did we decide to write Docker in Go?
Jérôme Petazzoni
 
Golang_Perl_Doc
Supreet Sethi
 
The GO Language : From Beginners to Gophers
I.I.S. G. Vallauri - Fossano
 
Go for SysAdmins - LISA 2015
Chris McEniry
 
Building robust and friendly command line applications in go
Andrii Soldatenko
 
Import golang; struct microservice
Giulio De Donato
 
Ndc2017
Ken Faulkner
 
OSCON2014 : Quick Introduction to System Tools Programming with Go
Chris McEniry
 
Java to Golang: An intro by Ryan Dawson Seldon.io
Mauricio (Salaboy) Salatino
 
The Go features I can't live without, 2nd round
Rodolfo Carvalho
 

Recently uploaded (20)

PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
PPTX
oapresentation.pptx
mehatdhavalrajubhai
 
PDF
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
PPTX
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
PPTX
Why Use Open Source Reporting Tools for Business Intelligence.pptx
Varsha Nayak
 
PDF
Why Use Open Source Reporting Tools for Business Intelligence.pdf
Varsha Nayak
 
PDF
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
PDF
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
PDF
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
PDF
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
How to Seamlessly Integrate Salesforce Data Cloud with Marketing Cloud.pdf
NSIQINFOTECH
 
PDF
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
jamescantor38
 
PDF
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pdf
Certivo Inc
 
PDF
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
PDF
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
PDF
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
PPTX
Presentation of Computer CLASS 2 .pptx
darshilchaudhary558
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
oapresentation.pptx
mehatdhavalrajubhai
 
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
Why Use Open Source Reporting Tools for Business Intelligence.pptx
Varsha Nayak
 
Why Use Open Source Reporting Tools for Business Intelligence.pdf
Varsha Nayak
 
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
How to Seamlessly Integrate Salesforce Data Cloud with Marketing Cloud.pdf
NSIQINFOTECH
 
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
jamescantor38
 
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pdf
Certivo Inc
 
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
Activate_Methodology_Summary presentatio
annapureddyn
 
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
Presentation of Computer CLASS 2 .pptx
darshilchaudhary558
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 

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