Book Image

Go Programming - From Beginner to Professional - Second Edition

By : Samantha Coyle
5 (4)
Book Image

Go Programming - From Beginner to Professional - Second Edition

5 (4)
By: Samantha Coyle

Overview of this book

Go Programming – From Beginner to Professional is a comprehensive guide that takes your proficiency in the Go programming language from novice to expert. Starting with fundamental concepts, this book covers variables, command-line tools, and working with data before delving into advanced concepts, including error handling, interfaces, and generics, harnessing Go’s latest features through hands-on exercises. Along the way, you’ll learn to structure projects using Go modules, manage packages effectively, and master debugging techniques. As you progress, you’ll get to grips with practical application-centric aspects such as command-line programming, file manipulation, and working with SQL databases. Additionally, the book explores web server development, RESTful APIs, and utilizing the Go HTTP client to interact with web applications. Further enhancing your Go skills, you’ll learn concurrent programming, testing methodologies, Go tools, and how to deploy applications in the cloud. Throughout the book, you’ll uncover Go’s hidden gems and gain insights into time manipulation, best practices, and more. By the end of this book, you’ll have worked through practical exercises and activities that’ll equip you with the knowledge and skills needed to excel as a proficient Go developer, primed for success in real-world projects.
Table of Contents (30 chapters)
1
Part 1: Scripts
6
Part 2: Components
11
Part 3: Modules
16
Part 4: Applications
20
Part 5: Building For The Web
23
Part 6: Professional

Programming from the Command Line

Overview

In this chapter, we will look at programming from the command line. We will see how Go is an excellent choice for creating powerful command-line utilities and applications, as well as discuss the many tools available for working with the command line using Go.

By reading this chapter, you will acquaint yourself with developing powerful command-line utilities and applications in Go. We will start with the basics of reading in command-line arguments and employing those flag values to control application behavior, take a peek at dealing with larger amounts of data inside and outside the application, and evaluate exit codes and best practices along the way. Then, we will dive a bit deeper and discuss strategies for gracefully handling interrupts, initiating external commands from our application, and using go install. Finally, we will learn how to create terminal user interfaces (TUIs), which allow us to craft robust, user-friendly command...