Summary
Over the course of this chapter, you’ve learned about the os/exec
package in depth. This included learning about the different ways to create commands: using the command
struct or the Command
method. Not only have we created commands, but we’ve also passed file descriptors to them to receive information back. We learned about the different ways to run a command using the Run
or Start
method and the multiple ways of retrieving data from the standard output, standard error types, and other file descriptors.
In this chapter, we also discussed the net/http
and net/url
packages, which are important to be comfortable with when creating HTTP requests to external API servers. Several examples taught us how to create requests with the methods on http.Client
, including Do
, Get
, Post
, and PostForm
.
It’s important to learn how to build robust code, and handling errors gracefully is part of the process. We need to know how to capture errors first, so we discussed...