December 2021
Intermediate to advanced
510 pages
11h 20m
English
You have the skeleton of your application ready, so let’s add the port scanning functionality, starting with the hosts list management. For this tool, you’ll create a separate package scan to develop the business logic, similar to the approach you used in Chapter 2, Interacting with Your Users.
In your application’s root directory, create a new directory named scan and switch to it:
| | $ cd $HOME/pragprog.com/rggo/cobra/pScan |
| | $ mkdir scan |
| | $ cd scan |
Now, create and edit the file hostsList.go. Start by defining the package name scan and the import list. For this package you’ll use the f0llowing packages: bufio to read data from files, errors to define error values, fmt to print formatted output, ...
Read now
Unlock full access