December 2021
Intermediate to advanced
510 pages
11h 20m
English
Start this project by creating a directory structure for your pScan application under the book’s root directory, and switch to the new directory:
| | $ mkdir -p $HOME/pragprog.com/rggo/cobra/pScan |
| | $ cd $HOME/pragprog.com/rggo/cobra/pScan |
Next, initialize the Go module for this application:
| | $ go mod init pragprog.com/rggo/cobra/pScan |
| | go: creating new go.mod: module pragprog.com/rggo/cobra/pScan |
The Cobra CLI framework works as a library to write CLI applications, and as a code generator to generate boilerplate code for a new CLI tool. You need to install the cobra executable command to generate code. Use go get to download and install Cobra:
| | $ go get -u github.com/spf13/cobra/cobra@v1.1.3 ... |
Read now
Unlock full access