Table of contents : Cover Page Title Page Copyright Page Dedication About the Author About the Reviewers Acknowledgements Preface Table of Contents 1. Understanding Golang and its Potential Introduction Structure Objectives Characteristics of Golang Programming Language Statically typed Garbage collection Cross-compilation “Batteries Included” standard library Version guarantees What kind of development work is Golang used in? Web applications Command Line Interface (CLI) Major applications written with Golang Docker Kubernetes CockroachDB Companies that use Golang Cloudflare Monzo Conclusion 2. Golang Fundamentals Introduction Structure Objectives Golang playground Installing and running Golang locally Main function in main package Imports Variable initialization Basic types List Maps Writing functions Structs Interfaces Loops Public versus private Using “Go” verb Channels Errors Conclusion 3. Exploring Data Structures Introduction Structure Objectives Singly linked list Doubly linked list Circular linked list Stack Queue Binary tree Hashed maps Conclusion 4. Understanding Algorithms Introduction Structure Objectives Big O notation Sorting algorithms and their importance Bubble sort Merge sort Quick sort Binary search Dynamic programming Conclusion 5. Getting Comfortable with Go Proverbs Introduction Structure Objectives The bigger the interface, the weaker the interface Make the zero value useful interface{} says nothing Gofmt’s style is no one’s favorite, yet everyone’s favorite Errors are values Do not just check errors, handle them gracefully Documentation is for users Do not panic Accept interfaces, return structs Never use global variables Conclusion 6. Building REST APIs Introduction Structure Objectives Why learn to build REST APIs? HTTP verbs HTTP status codes Building a “Hello World” REST API Golang application Building a URL shortener Conclusion 7. Testing in Golang Introduction Structure Objectives Why build tests? Test-driven development Writing a simple unit test Table driven tests Mocking Setup and teardown of environments within tests HTTP testing Golden files Conclusion 8. Deploying a Golang Application in a Virtual Machine Introduction Structure Objectives Using SSH Using SCP Using Systemd to run the Golang application Debugging the Golang application on the server Real-life deployments with virtual machines Conclusion 9. Deploying a Containerized Golang Application Introduction Structure Objectives Docker basics Docker command basics Building a Golang application in a Docker container Using Docker compose on a local workstation Using docker-compose on a virtual machine Deploying the application via Kubernetes Conclusion 10. Microservices with Golang Applications Introduction Structure Objectives What are microservices, and why are microservices? Demo-ing an application stack with multiple applications via docker-compose Demo-ing an application with multiple applications in Kubernetes Conclusion 11. Introduction to Monitoring and Logging Introduction Structure Objectives Why monitoring and logging are important? Introduction to Prometheus Instrumenting an application with metrics to be consumed by Prometheus Viewing metrics on Prometheus Quick word on logging Conclusion 12. Adding Concurrency in Golang Application Introduction Structure Objectives Concurrency features in Golang Exchanging messages and persisting it locally Using channels to receive interrupts in a program Live reload of configurations Parallelize parts of an application Conclusion 13. What is Next? Introduction Structure Objectives GRPC—alternative communication protocols SRE principles for reliable applications Profiling Working with data storage Embedding files Generics Fuzzing Conclusion Index