Wrapping Up
In this chapter, you used the Cobra framework and the net/http package to develop a command-line application that interacts with a remote REST API using different techniques and options. You also used the encoding/json package to parse JSON data. These skills allow you to gather data from a variety of sources on the Internet or from your environment to create powerful and flexible tools.
You also explored and applied several techniques for testing your API server and your command-line client implementation. By combining unit tests with simulated responses and test servers, you can execute constant local tests while using integration tests sporadically to ensure your application works reliably across different environments.
In the ...
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.
Read now
Unlock full access