SlideShare a Scribd company logo
Building Command
Line Tools
with Golang
Takaaki Mizuno
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 Use Cases
Web Services
Mobile Applications ( Android / iOS )
Command Line Tools
Golang at Innovatube
We selected 2 primary languages for web 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 / iOS )
Daemon / Service
Command Line Tools
Golang Use Cases
Web Services
Mobile Applications ( Android / iOS )
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 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 )
Library Dependency
Library version dependency might become problems on
team development / source code distribution.
Only using “go get” cannot manage library versions.
Use “godep”
https://github.com/tools/godep
It generates “Godeps.json” file which stores library versions.
Use “godep get” to restore libraries.
“godep go build” uses Godeps libraries
{
"ImportPath": "github.com/takaaki-mizuno/awesomecommand",
"GoVersion": "go1.6",
"Deps": [
{
"ImportPath": "github.com/codegangsta/cli",
"Comment": "1.2.0-237-g71f57d3",
"Rev": "71f57d300dd6a780ac1856c005c4b518cfd498ec"
}
]
}
Colorize UI
mgutz/ansi
Make UI Colorize
mattn/go-colorable
Wrap io.Writer to Support Windows DOS Console
Building Dashboard
gizak/termui
Can build Text Base Dashboard with GUI Building-
Like APIs
Happy Coding!
Q & A

More Related Content

PDF
[INNOVATUBE] Tech Talk #3: Golang - Vũ Nguyễn
PDF
Building Command Line Tools with Golang
PPT
Come With Golang
PPTX
Developing Cross Platform Applications with Golang
PDF
13 practical tips for writing secure golang applications
PDF
Golang from Scala developer’s perspective
PPTX
Golang Channels use cases
PPTX
Wonders of Golang
[INNOVATUBE] Tech Talk #3: Golang - Vũ Nguyễn
Building Command Line Tools with Golang
Come With Golang
Developing Cross Platform Applications with Golang
13 practical tips for writing secure golang applications
Golang from Scala developer’s perspective
Golang Channels use cases
Wonders of Golang

What's hot (20)

PDF
Getting started with Go - Florin Patan - Codemotion Rome 2017
PDF
GoLang Introduction
PPTX
Introduction to GoLang
PDF
Dependency management in golang
PPTX
Optimizing and Profiling Golang Rest Api
PDF
welcome to gopherlabs - why go (golang)?
PDF
Why you should care about Go (Golang)
PPT
Introduction to Go-Lang
PDF
(Live) build and run golang web server on android.avi
PPTX
Golang - Overview of Go (golang) Language
PPT
A First Look at Google's Go Programming Language
PDF
Golang for PHP programmers: A practical introduction
PDF
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
PDF
Coding with golang
PDF
Golang online course
PDF
Inroduction to golang
PPTX
Introduction to go lang
PDF
The Go programming language - Intro by MyLittleAdventure
PPTX
Golang start and tips
PPTX
Getting started with Go - Florin Patan - Codemotion Rome 2017
GoLang Introduction
Introduction to GoLang
Dependency management in golang
Optimizing and Profiling Golang Rest Api
welcome to gopherlabs - why go (golang)?
Why you should care about Go (Golang)
Introduction to Go-Lang
(Live) build and run golang web server on android.avi
Golang - Overview of Go (golang) Language
A First Look at Google's Go Programming Language
Golang for PHP programmers: A practical introduction
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Coding with golang
Golang online course
Inroduction to golang
Introduction to go lang
The Go programming language - Intro by MyLittleAdventure
Golang start and tips
Ad

Viewers also liked (20)

PDF
Golang server design pattern
PPTX
Golang basics for Java developers - Part 1
PPTX
Golang for OO Programmers
PPTX
Write microservice in golang
PPTX
Go for statistical programming
PDF
Simplifying open stack and kubernetes networking with romana
PPTX
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...
PPTX
Container Networking Challenges for Production Readiness
PPTX
DockerCon US 2016 - Docker Networking deep dive
PPTX
Git Flow and JavaScript Coding Style
PDF
Introduction to Grunt.js on Taiwan JavaScript Conference
ODP
Golang Template
PDF
Cloud Native SDN
PPTX
Docker meetup oct14
PDF
Gearman work queue in php
PDF
Phpconf 2011 introduction_to_codeigniter
PDF
Go 1.8 Release Party
PPTX
Container Networking Meetup March 31 2016
PDF
Evolving Virtual Networking with IO Visor [OpenStack Summit Austin | April 2016]
PPTX
Jenkins vs gogs
Golang server design pattern
Golang basics for Java developers - Part 1
Golang for OO Programmers
Write microservice in golang
Go for statistical programming
Simplifying open stack and kubernetes networking with romana
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...
Container Networking Challenges for Production Readiness
DockerCon US 2016 - Docker Networking deep dive
Git Flow and JavaScript Coding Style
Introduction to Grunt.js on Taiwan JavaScript Conference
Golang Template
Cloud Native SDN
Docker meetup oct14
Gearman work queue in php
Phpconf 2011 introduction_to_codeigniter
Go 1.8 Release Party
Container Networking Meetup March 31 2016
Evolving Virtual Networking with IO Visor [OpenStack Summit Austin | April 2016]
Jenkins vs gogs
Ad

Similar to [INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno (20)

PPTX
Building CLI Applications with Golang
PDF
How to build and distribute CLI tool in 15 minutes with Golang
PDF
Building Awesome CLI apps in Go
PPTX
Ready, set, go! An introduction to the Go programming language
PDF
Getting Started with Go
PDF
Introduction to Go
PDF
Happy Go Programming Part 1
PDF
Docker and Go: why did we decide to write Docker in Go?
PPTX
Ndc2017
PDF
Going All-In With Go For CLI Apps
PDF
Java to Golang: An intro by Ryan Dawson Seldon.io
PDF
Import golang; struct microservice
PDF
Golang_Perl_Doc
PDF
Golang workshop
PDF
Writing Rust Command Line Applications
PPTX
The GO Language : From Beginners to Gophers
PDF
A gentle intro to Golang and the Go-universe
PDF
Building and Releasing a Golang CLI Tool
PDF
Build Golang projects properly with Makefiles
PDF
OSCON2014 : Quick Introduction to System Tools Programming with Go
Building CLI Applications with Golang
How to build and distribute CLI tool in 15 minutes with Golang
Building Awesome CLI apps in Go
Ready, set, go! An introduction to the Go programming language
Getting Started with Go
Introduction to Go
Happy Go Programming Part 1
Docker and Go: why did we decide to write Docker in Go?
Ndc2017
Going All-In With Go For CLI Apps
Java to Golang: An intro by Ryan Dawson Seldon.io
Import golang; struct microservice
Golang_Perl_Doc
Golang workshop
Writing Rust Command Line Applications
The GO Language : From Beginners to Gophers
A gentle intro to Golang and the Go-universe
Building and Releasing a Golang CLI Tool
Build Golang projects properly with Makefiles
OSCON2014 : Quick Introduction to System Tools Programming with Go

More from Nexus FrontierTech (20)

PPTX
[Executive Lounge Talk] Digital Transformation Journey
PDF
[AI series Talk #2] From PoC to Production - A Case Study
PDF
[AI Series Talk #2] Moving AI from PoC Stage to Production
PDF
[VFS 2019] Introduction to GANs - Pixta Vietnam
PPTX
[VFS 2019] Enabling Young Generation for Future - AWS Vietnam User Group
PPTX
[VFS 2019] Building chatbot with RASA
PPTX
[VFS 2019] Vietnamese Speech-to-Text: Applications and Product
PDF
[VFS 2019] How AI Will Innovate Recruitment
PPTX
[VFS 2019] AI in Finance
PPTX
[VFS 2019] Preventive Approach to Designing and Selling Healthy AI System
PDF
[VFS 2019] Phương pháp phát hiện bất thường bằng học máy
PDF
[VFS 2019] OCR Techniques for Digital Transformation Evolution
PPTX
[VFS 2019] Human Activity Recognition Approaches
PPTX
[VFS 2019] Aimesoft Solutions
PPTX
[VFS 2019] Datamart Introduction (brief)
PDF
[VFS 2019] Data Strategy for Vietnamese Businesses to Levarage AI
PPTX
[VFS 2019] AI for Banks
PDF
[VFS 2019] Digital Solution for Enterprises: 24/7 A.I English Speaking Coach
PDF
[VFS 2019] Project Management for AI-based Product - A Better Approach
PDF
[VFS 2019] AI Ecosystem transition from zero to hero - case study by rubikAI
[Executive Lounge Talk] Digital Transformation Journey
[AI series Talk #2] From PoC to Production - A Case Study
[AI Series Talk #2] Moving AI from PoC Stage to Production
[VFS 2019] Introduction to GANs - Pixta Vietnam
[VFS 2019] Enabling Young Generation for Future - AWS Vietnam User Group
[VFS 2019] Building chatbot with RASA
[VFS 2019] Vietnamese Speech-to-Text: Applications and Product
[VFS 2019] How AI Will Innovate Recruitment
[VFS 2019] AI in Finance
[VFS 2019] Preventive Approach to Designing and Selling Healthy AI System
[VFS 2019] Phương pháp phát hiện bất thường bằng học máy
[VFS 2019] OCR Techniques for Digital Transformation Evolution
[VFS 2019] Human Activity Recognition Approaches
[VFS 2019] Aimesoft Solutions
[VFS 2019] Datamart Introduction (brief)
[VFS 2019] Data Strategy for Vietnamese Businesses to Levarage AI
[VFS 2019] AI for Banks
[VFS 2019] Digital Solution for Enterprises: 24/7 A.I English Speaking Coach
[VFS 2019] Project Management for AI-based Product - A Better Approach
[VFS 2019] AI Ecosystem transition from zero to hero - case study by rubikAI

Recently uploaded (20)

PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
top salesforce developer skills in 2025.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPT
Introduction Database Management System for Course Database
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
medical staffing services at VALiNTRY
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Transform Your Business with a Software ERP System
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
top salesforce developer skills in 2025.pdf
Digital Strategies for Manufacturing Companies
How Creative Agencies Leverage Project Management Software.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Odoo Companies in India – Driving Business Transformation.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
ManageIQ - Sprint 268 Review - Slide Deck
Upgrade and Innovation Strategies for SAP ERP Customers
Design an Analysis of Algorithms II-SECS-1021-03
Introduction Database Management System for Course Database
Softaken Excel to vCard Converter Software.pdf
CHAPTER 2 - PM Management and IT Context
Adobe Illustrator 28.6 Crack My Vision of Vector Design
medical staffing services at VALiNTRY
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
VVF-Customer-Presentation2025-Ver1.9.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Transform Your Business with a Software ERP System

[INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno

  • 1. Building Command Line Tools with Golang Takaaki Mizuno
  • 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 Use Cases Web Services Mobile Applications ( Android / iOS ) Command Line Tools
  • 5. Golang at Innovatube We selected 2 primary languages for web 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
  • 6. Golang Use Cases Web Services Mobile Applications ( Android / iOS ) Daemon / Service Command Line Tools
  • 7. Golang Use Cases Web Services Mobile Applications ( Android / iOS ) Daemon / Service Command Line Tools
  • 9. Which Language Are You Using For Writing Command Line Tools ? Node.js Java Python Ruby C++ Golang
  • 10. Which Language Are You Using For Writing Command Line Tools ? Node.js Java Python Ruby C++ Golang
  • 11. 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
  • 12. Benefit for Command Line Tools Single Binary Cross Platform ( Can support Windows easily ) No run-time dependencies Concurrency
  • 13. Many famous “command line” tools are written in Golang docker Terraform ( By Hashicorp) hub ( by GitHub )
  • 15. 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 )
  • 16. 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
  • 17. Easy To Use gcli new -command=init -command=get -owner=takaaki-mizuno awesomecommand % awesomecommand init
  • 18. DEMO
  • 19. 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
  • 20. Some Tips For Golang ( command line tools )
  • 21. Library Dependency Library version dependency might become problems on team development / source code distribution. Only using “go get” cannot manage library versions.
  • 22. Use “godep” https://github.com/tools/godep It generates “Godeps.json” file which stores library versions. Use “godep get” to restore libraries. “godep go build” uses Godeps libraries { "ImportPath": "github.com/takaaki-mizuno/awesomecommand", "GoVersion": "go1.6", "Deps": [ { "ImportPath": "github.com/codegangsta/cli", "Comment": "1.2.0-237-g71f57d3", "Rev": "71f57d300dd6a780ac1856c005c4b518cfd498ec" } ] }
  • 23. Colorize UI mgutz/ansi Make UI Colorize mattn/go-colorable Wrap io.Writer to Support Windows DOS Console
  • 24. Building Dashboard gizak/termui Can build Text Base Dashboard with GUI Building- Like APIs
  • 26. Q & A