Essentials of Go Programming

Author:

Baiju Muthukadan

License:

This book is licensed under Creative Commons Attribution-ShareAlike 4.0 International License.

_images/cover-small.png

Note

I typeset this book in the TeX system for printing paperback editions. The target output format is PDF, which I used to self-publish through Amazon. I created this HTML version for the convenience of online reading.

Preface

The only way to learn a new programming language is by writing programs in it — The C Programming Language, Kernighan & Ritchie

If you are searching for a straightforward and robust programming language suitable for a variety of applications, Go is an excellent option to consider. Go is an open-source language developed by Google with significant contributions from the community. The project originated in 2007 through the efforts of Robert Griesemer, Rob Pike, and Ken Thompson. It was subsequently released as open-source software by Google in November 2009. Go has gained popularity among numerous organizations across diverse problem domains. Please note that the preferred term for the Go programming language when searching for information is Golang.

This book serves as an introduction to the fundamentals of Go programming. Whether you are a novice programmer or someone seeking a refresher, I hope this book proves to be valuable. This book is specifically designed for practice rather than just reading. Note-taking is an important skill that can help you learn more effectively, remember information better, and stay organized. I recommend taking notes while reading and engaging in the exercises to enhance your learning experience.

If you are entirely new to programming, I recommend exploring the Scratch programming language website at https://scratch.mit.edu. It provides helpful resources for those who have not yet delved deeply into programming. Once you have grasped the fundamental programming concepts, you can return to this book.

My journey with programming began around 2003 when I started working with Python. Over the course of a decade, I gained extensive experience in Python programming. In 2013, a former colleague introduced me to Go, and it proved to be a refreshing experience. Although there are notable differences between Python and Go, I was particularly impressed by Go’s simplicity in the early stages. Compared to other languages I had explored, the learning curve for Go was remarkably smooth.

Upon developing an interest in Go, one of my initial aspirations was to write a book about it. Writing has long been my passion, with my first foray being a blog on LiveJournal in 2004. In 2007, I authored my first book on Zope component architecture. Writing can be an enjoyable activity, although at times it can become demanding. Since this book is self-published, I had the freedom to take my time and ensure its quality.

Throughout the years, I have conducted numerous Go workshops in various parts of India. During these workshops, I always desired to offer something more to the participants, and I believe this book will fulfill that aspiration.

Software development encompasses more than just programming languages. It involves acquiring additional skills such as proficiently using text editors/IDEs, version control systems, and your preferred operating system. Furthermore, it is beneficial to continually expand your knowledge by exploring different languages and technologies throughout your career. While Go leans toward an object-oriented programming style, you may also find it worthwhile to explore functional programming languages like Scheme and Haskell.

Apart from technical skills, business domain knowledge and soft skills play a pivotal role in your career growth. However, discussing these aspects in detail falls beyond the scope of this context. With that said, I conclude by wishing you a successful career.

Baiju Muthukadan
Kozhikode, Kerala, India
May 2023

Acknowledgements

First and foremost, I express my gratitude to my God for granting me the ability to write this book. I would like to extend my heartfelt thanks to my wife, Nithya, and our two sons, Aadidev and Aarav, for their unwavering love, care, and support throughout this endeavor. I am also indebted to my colleagues and friends for their invaluable assistance.

I am incredibly grateful for the abundance of feedback I have received from my colleagues, friends, and fellow members of the Go community. Special recognition goes to Satish V.J., Nurali Virani, Preeti Chandrashekar, Parvathy V.R., Sunil Malagi, Bilal M.K, Iliyas Shirol, Pratik Shah, and Andrei Tudor Călin for their contributions.

The encouragement I have received from the Go community has been truly remarkable, and I feel privileged to be a part of it. My sincere appreciation goes out to the entire Go community for their support and camaraderie.

Colophon

The author typeset the print version of this book in Dejavu and Source Code Pro typefaces using the TeX system. LaTeX macros and extensions were used. Many other TeX packages were also used in the preparation of this book. The book uses two variants of the Dejavu typeface: DejaVuSerif and DejaVuSans. It also uses SourceCodePro for monospaced text.

The picture used on the book cover is taken from Wikimedia Commons. The original photo is by Mykl Roventine and it is licensed under the Creative Commons CC BY 2.0 license.

The typefaces used in the cover design include Cabin, CabinCondensed, and DejaVuSans.

Without the contributions of all the developers who work on free and open source projects, it would not be possible to publish a book like this. Thank you to all of these contributors for their hard work and dedication.

Reviews and Feedback

The author would be very grateful for your reviews on Amazon and other websites. When you tweet about the book, please include the hashtag #essentialsofgo. Your blog posts, videos, or anything else you create about this book will help to spread the word. Your reviews and social media posts can help other people find the book and learn about Go programming.

Please kindly send your feedback and suggestions to the following email address: baiju.m.mail@gmail.com. You have the option to create issues in the GitHub repository at: https://github.com/baijum/essential-go. Additionally, you can propose changes by creating pull requests.

Thank you for reviewing my book. Your feedback and suggestions are very valuable and will help me improve the book. I will carefully consider your feedback and make changes as needed. If you have any further questions or suggestions, please do not hesitate to contact me.

Why should you review the book?

  1. This book will help many people learn Go programming. As a fellow Go community member, you are contributing to this effort.

  2. Your feedback will influence the content of the book.

  3. As you study the book with a critical mind, you are enhancing your Go knowledge. The learning is more intense than reading a book casually.

  4. You will be required to refer to other works to verify the content in the text. This will help you to broaden your knowledge on the subject.

  5. You are supporting a fellow Go community member. This will motivate me to contribute more.

  6. Your name will be mentioned in the book at the beginning in the acknowledgments, just after the preface.

  7. The book is a free or open source book licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.

How to review the book?

Reflect on these questions as you read the book.

  1. How is the structure of the chapters in the book?

  2. How are the sections under each chapter organized?

  3. Is the book consistent throughout all the pages? (Consider consistency of organization, writing style, terminology usage, etc.)

  4. Is there any essential point missing when explaining a particular topic?

  5. Is the logical flow of introducing the concepts easy to follow?

  6. Is the narrative clear, reasonable, and engaging?

  7. Are the examples and exercises short and easy to understand?

  8. Did you notice any sentence or paragraph that is difficult to understand?

  9. Did you see an opportunity to add a side note that would be helpful to the reader?

  10. Did you notice any awkward use of the English language? (You can ignore minor language issues.)

  11. How can this book be made more interesting?

When you provide feedback about a chapter, please specify the chapter title. If your feedback is about a section, please include the section number and chapter title. There is no need to mention the page number, as it may change.

If you are able to send a pull request to the Git repo with your changes, that would be preferable to sending an email. If sending a pull request is not possible, you can send an email as explained here.

About the Author

Baiju Muthukadan is a software engineer from Kerala, India. He began his software development career in 2002. Over the years, Baiju has contributed to many free and open source software projects. In 2007, he authored his first book on Python. Since 2013, he has been working on various Go projects. His Twitter handle is @baijum.