About This Course
Learn about the course and its contents.
We'll cover the following
How to use this course
To best follow this course and test the code examples, we installed Go 1.13 on our platform. At the time of this writing, the current version of Go is 1.16.
The code examples in this course use the Go modules to manage package dependencies. By using Go modules,
we’re no longer required to code under the $GOPATH
directory. Modules have
been available since Go 1.11 and enabled by default since 1.13.
We need to make sure the Go binary go
is in our $PATH
variable so we can execute Go
commands from anywhere without prefixing the absolute path. For example,
to run tests, we type go test
, and to build programs, we run go build
. Some
examples also execute the binary version of our tools. These are typically
installed in the directory $HOME/go/bin
. We expect that this directory exists and
is included in our $PATH
variable.
Note: We already have the Go environment installed on our platform, so no installation will be needed.
What’s in this course
In this course, we’ll go through the process of developing a command-line application with Go by building a word counter. We’ll also add command-line flags and build this application for different platforms.
We’ll design and write a command-line tool to manage lists of to-do items in accordance with common input/output standards by applying different techniques. We’ll take input
from the standard input (STDIN
) stream, parse command-line parameters,
and define flags for our tool using the flags
package. We’ll use environment
variables to increase the flexibility of our tools. In addition, we’ll display
information and results back to the user through the standard output (STDOUT
) stream, and present errors using the standard error (STDERR
) stream
for proper error handling. Finally, we’ll explore Go interfaces by applying the
io.Reader
interface in particular.
About the example code
The code provided in this course aims to illustrate concepts of the language that are useful when we’re building our own programs and command-line tools.
This code isn’t production-ready. Even though each chapter shows a complete example that we can use for experimentation, the code may require additional features and checks for use in real-life scenarios.