Exercises

Powerful Command-Line Applications in Go — by Ricardo Gerardi (82 / 127)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Generating Command Completion an d Documentation | TOC | Wrapping Up 👉

Before you move on, you should build on the skills and techniques you explored in this chapter. Here are some suggestions:

  • Allow the user to provide port ranges, such as 1–1024, in addition to specific ports for scan.
  • Validate the provided port numbers are within the proper range for TCP ports from 1 to 65535.
  • Allow the user to execute UDP port scans in addition to TCP. Update the scan package and the command-line tool accordingly.
  • Add a new flag to the scan subcommand allowing the user to specify a filter to show only open or closed ports.
  • Add a new flag to the scan subcommand allowing the user to specify a custom timeout for the scan.

👈 Generating Command Completion an d Documentation | TOC | Wrapping Up 👉

Powerful Command-Line Applications in Go by Ricardo Gerardi can be purchased in other book formats directly from the Pragmatic Programmers. If you notice a code error or formatting mistake, please let us know here so that we can fix it.

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.