Skip to Content
Building RESTful Web services with Go
book

Building RESTful Web services with Go

by Naren Yellavula
December 2017
Intermediate to advanced
316 pages
6h 58m
English
Packt Publishing
Content preview from Building RESTful Web services with Go

Collecting command-line arguments in CLI

There is a difference between command-line arguments and flags. The following diagram clearly specifies the distinction between them:

Suppose that we have a command-line app called storeMarks for saving the marks of a student. It has a flag (called save) to specify whether details should be pushed to DB or not. The arguments that are given are the name and actual marks of the student. We already saw how to collect the flag values in the program. In this section, we will see how to collect program arguments in an expressive way.

For collecting arguments, we use the c.Args function, where c is the cli ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On RESTful Web Services with Go - Second Edition

Hands-On RESTful Web Services with Go - Second Edition

Naren Yellavula
Microservices with Go

Microservices with Go

Alexander Shuiskov

Publisher Resources

ISBN: 9781788294287Supplemental Content