Book title ....1
Inner title ....3
Copyright....4
Dedicated....4
About the Author....6
About the Reviewers....6
Acknowledgements....8
Preface....8
Code Bundle and Coloured Images....12
Piracy....12
Table of Contents....14
Chapter 1: Understanding Golang and its Potential....20
Introduction....20
Structure....20
Objectives....22
Characteristics of Golang Programming Language....22
Statically typed....22
Garbage collection....24
Cross-compilation....26
“Batteries Included” standard library....26
Version guarantees....26
What kind of development work is Golang used in?....28
Web applications....28
Command Line Interface (CLI)....28
Major applications written with Golang....28
Docker....30
Kubernetes....30
CockroachDB....32
Companies that use Golang....32
Cloudflare....32
Monzo....34
Conclusion....34
Chapter 2: Golang Fundamentals....36
Introduction....36
Structure....36
Objectives....38
Golang playground....38
Installing and running Golang locally....38
Main function in main package....40
Imports....40
Variable initialization....44
Basic types....44
List....48
Maps....52
Writing functions....52
Structs....58
Interfaces....64
Loops....68
Public versus private....72
Using “Go” verb....76
Channels....80
Errors....80
Conclusion....82
Chapter 3: Exploring Data Structures....84
Introduction....84
Structure....84
Objectives....86
Singly linked list....86
Doubly linked list....96
Circular linked list....98
Stack....100
Queue....102
Binary tree....104
Hashed maps....108
Conclusion....112
Chapter 4: Understanding Algorithms....114
Introduction....114
Structure....114
Objectives....116
Big O notation....116
Sorting algorithms and their importance....118
Bubble sort....118
Merge sort....122
Quick sort....126
Binary search....132
Dynamic programming....134
Conclusion....138
Chapter 5: Getting Comfortable with Go Proverbs....140
Introduction....140
Structure....142
Objectives....142
The bigger the interface, the weaker the interface....142
Make the zero value useful....142
interface{} says nothing....144
Gofmt’s style is no one’s favorite, yet everyone’s favorite....144
Errors are values....148
Do not just check errors, handle them gracefully....148
Documentation is for users....150
Do not panic....152
Accept interfaces, return structs....154
Never use global variables....158
Conclusion....160
Chapter 6: Building REST APIs....162
Introduction....162
Structure....164
Objectives....164
Why learn to build REST APIs?....164
HTTP verbs....166
HTTP status codes....168
Building a “Hello World” REST API Golang application....170
Building a URL shortener....174
Conclusion....198
Chapter 7: Testing in Golang....200
Introduction....200
Structure....202
Objectives....202
Why build tests?....202
Test-driven development....202
Writing a simple unit test....204
Table driven tests....206
Mocking....214
Setup and teardown of environments within tests....220
HTTP testing....226
Golden files....228
Conclusion....230
Chapter 8: Deploying a Golang Application in a Virtual Machine....230
Introduction....230
Structure....232
Objectives....232
Using SSH....232
Using SCP....240
Using Systemd to run the Golang application....246
Debugging the Golang application on the server....250
Real-life deployments with virtual machines....252
Conclusion....254
Chapter 9: Deploying a Containerized Golang Application....256
Introduction....256
Structure....258
Objectives....258
Docker basics....258
Docker command basics....260
Building a Golang application in a Docker container....270
Using Docker compose on a local workstation....284
Using docker-compose on a virtual machine....294
Deploying the application via Kubernetes....300
Conclusion....306
Chapter 10: Microservices with Golang Applications....308
Introduction....308
Structure....310
Objectives....310
What are microservices, and why are microservices?....310
Demo-ing an application stack with multiple applications via docker-compose....314
Demo-ing an application with multiple applications in Kubernetes....336
Conclusion....348
Chapter 11: Introduction to Monitoring and Logging....350
Introduction....350
Structure....352
Objectives....352
Why monitoring and logging are important?....352
Introduction to Prometheus....354
Instrumenting an application with metrics to be consumed by Prometheus....356
Viewing metrics on Prometheus....360
Quick word on logging....368
Conclusion....368
Chapter 12: Adding Concurrency in Golang Application....370
Introduction....370
Structure....372
Objectives....372
Concurrency features in Golang....372
Exchanging messages and persisting it locally....374
Using channels to receive interrupts in a program....378
Live reload of configurations....380
Parallelize parts of an application....384
Conclusion....388
Chapter 13: What is Next?....388
Introduction....388
Structure....388
Objectives....390
GRPC—alternative communication protocols....390
SRE principles for reliable applications....394
Profiling....394
Working with data storage....398
Embedding files....402
Generics....404
Fuzzing....406
Conclusion....408
Index....408
Back title ....414
Golang holds significance because of its emphasis on simplicity, readability, impressive performance, and built-in support for concurrency. If you want to elevate your Golang programming skills and become a more proficient developer, then this book is for you.“Golang for Jobseekers” starts by providing a comprehensive introduction to Go, covering its syntax, fundamental concepts, and unique features that make it an efficient language for development. It delves deeply into data structures and algorithms, equipping you with techniques to optimize your code and solve complex problems with elegance and speed. Furthermore, the book explores the art of building robust RESTful API applications in Go. It teaches you industry best practices and architectural patterns for creating scalable, secure, and maintainable APIs. The book then takes you through a step-by-step journey from development to production, demonstrating how to deploy Go applications in different environments, ranging from virtual machines to containers on Kubernetes. Lastly, it helps you understand essential concepts like monitoring and logging, enabling you to ensure the performance and health of your applications in real-world scenarios.By the end of the book, you will be equipped to confidently showcase your expertise during interviews, giving you a competitive edge in the job market.
Ideal for newcomers to the industry, this book explores the entire journey of application development, from concept to production-ready deployment.