How To Code in Go

Categories:

Recommended

Preface — Getting Started with this Book

We recommend that you begin with a clean, new server to start learning how to program with Go. You can also use a local computer like a laptop or desktop as well. One of the benefits of Go is that most of the code that you write will compile and run on Linux, Windows, and macOS, so you can choose a development environment that suits you.

If you are unfamiliar with Go, or do not have a development environment set up, Chapter 1 of this book goes into detail about how to install Go for development on a local Ubuntu 18.04 system, Chapter 2 explains how to set up Go on macOS, and Chapter 3 covers how to get started with Go using Windows 10.

Once you are set up with a local or remote development environment, you will be able to follow along with each chapter at your own pace, and in the order that you choose.

Introduction

About this Book

Go (or GoLang) is a modern programming language originally developed by Google that uses high-level syntax similar to scripting languages. It is popular for its minimal syntax and innovative handling of concurrency, as well as for the tools it provides for building native binaries on foreign platforms.

All of the chapters in this book are written by members of the Gopher Guides team. Individually, each team member is engaged with their local software development communities with hosting and organizing meetups and conferences. Collectively, the Gopher Guides Team is committed to educating Go developers, and fostering an inclusive and supportive global community of developers that welcomes beginners and experts alike.

Motivation for this Book

Many books and other educational resources about Go rely on building progressively more complex examples to illustrate concepts like composition, testing, and packaging. This book explores various Go topics with clear, self-contained example code.

Structuring the book this way means that the examples in each chapter are concise and specific to the topic of the chapter. For those who are starting out learning about Go, the chapters are ordered in a way that should guide you from a beginning “Hello, World” program all the way to parsing command line flags with your programs.

For more experienced programmers who would like to use this book as a reference, or readers who like to choose what to focus on, this approach of loosely related chapters also means that you can skip between chapters to learn about particular concepts that interest you without missing out on context from preceding chapters.

Learning Goals and Outcomes

This book starts with chapters on how to set up and configure a local Go development environment. It ends with chapters that explain how to build your Go programs with conditional imports to target specific operating systems, and a final chapter on parsing command line flags to help you build your own utilities.

By the end of this book you will be able to write programs that use conditional logic with switch statements, define your own data structures, implement interfaces to reuse portions of your code, and write custom error handling functions.

These examples are just a small sample of the topics that are covered in the book. We hope that you continue learning about Go once you are finished reading it. Go is a fun, powerful language that is gaining in popularity. We also hope that this book enables you to become a more productive Go programmer, and that it helps you learn how to build useful software with Go for yourself or others.

Category:

Attribution

Mark Bates, Cory Lanou, Timothy J. Raymond. How To Code in Go. https://www.digitalocean.com/community/books/how-to-code-in-go-ebook

VP Flipbook Maker

Convert your work to digital flipbook with VP Online Flipbook Maker! You can also create a new one with the tool. Try it now!