In this tutorial, we walk through basic concepts and help messages in Docopt. You’ll learn about a practical use case that you can code right now.

› Shortly about Docopt

Docopt is a command-line interface description language. It has many implementations for different programming languages. In this tutorial, we’ll discuss the Go version: Docopt Go.

This library gives programmers the ability to describe a program interface with a well-structured help message.

› Before You Begin

Install Docopt on your computer with this command:

$ go get -u -v

The -u flag instructs go get to use the network to update the named packages and their dependencies. By default, get uses the network to check out missing packages but does not use it to look for updates to existing packages.

The -v flag enables verbose progress and debug output.

See this resource to learn more about the go get command.

Import the library in your *.go file as follows:

import docopt “”

#golang-libraries #golang-tutorial #command-line #golang

Exploring Go Libraries: Docopt
12.80 GEEK