Automate the Boring Stuff with GO is directly inspired by the masterful Al Sweigart's Automate the Boring Stuff with Python. If you're also interested in learning Python, please have a look.  Like, Automate the Boring Stuff with Python, this book aims to be a beginner-friendly introduction to programming with GO and provide immediate useful programs for day-to-day office work.

About the Author

Toul DeGuia-Cranmer is a software engineer with industry experience in DevSecOps and Data Analytics roles. Currently, he is focusing on Cyber Security as an Infrastructure Analyst-- who does a lot of automation.

GO is his favorite programming language, and he's used it to build Twitter bots, a Free Resume Helper web app, and TikTok growth machine learning models.

He's also made other proprietary tools that Fortune 500 companies use to maintain and obtain the rigorous ISO27001 & ISO27002 type 1 and type 2 attestations.

His tools built with GO have won him the HP, Inc. Personal Software Systems "Game Changer" Award.


"Are you serious?"
In my early 20's, my wife worked at an agency start-up with influencers. Her responsibilities included keeping track of all their posts and metadata, likes, comments, and follower count analysis across Twitter and YouTube. Across 20+ influencer partnerships, that's a lot to track!

During one high-growth month when the number of influencers doubled, she worked 12-plus hours a day, chugging energy drinks and coffee to manually input data into Excel for weeks to hit deadlines.

"I can automate that process," I told her. She came home late and collapsed with exhaustion.

"Sure," she replied, half-asleep already.

That night I reviewed and automated her manual data collection and inputting processes– finishing at the crack of dawn.

I'd only been programming for a few months and was still in school, where they only taught abstract stuff and gave homework that had no real-world use cases. So I spent most of that time sorting through online blogs/docs, looking for practical code samples.

However, that night of duct tape programming reduced her work from a week-long caffeine-fueled 12-hour marathon to seconds while she slept.

I'd also scheduled it to run in the AWS cloud at 3 AM each weekday, so each morning all there was to do is grab the files from the automated e-mail.

My wife returned to her standard set of tasks as Communications Director, knowing that the manual tasks were automated.

That is the power of programming. With enough time and knowledge, computers can automate any manual digital tasks.

Too many people spent hours upon hours doing things via clicking and typing on the computer, unaware they could reduce the time to seconds if they knew a programming language.

That's what this book aims to teach, just enough programming to make mundane tasks quick.

Who will get the most out of this book?

This book is a beginner-friendly free e-book to learn to program with the GO language and what programming can accomplish. You do not need a computer science degree or any other degree or cert to get value from this book. This book hopes you can see how useful and fun knowing a little programming can be.

Many of the automated tasks in the book might seem trivial to advanced programmers, but for beginners, they provide immediate real-world benefits in their day-to-day lives.

In other words, this book is not here to bore you with the nitty-gritty details of computer science. Instead, it focuses on code that works, and if the reader would like to make the code prettier or more idiomatic, they may do so later.

This book is not designed as the ultimate reference manual for all things GO. Instead, it would be advised that if the reader enjoys this book, then consider using the following additional books for more in-depth and advanced topics:

(1) Follow the official blog posts to stay up to date with new language developments
(2) The GO Programming book
(3)  for how to build a web dev framework from scratch
(4) Let's Go for how to build an API from scratch
(5) Machine Learning with GO for how to do machine learning

What is programming?

In the most straightforward terms, programming tells a computer what to do so that you don't have via typing and clicking.

However, computers aren't like humans, so we must use programming languages to communicate.

A programming language lets writers tell a computer what to do with a natural language like English. The instructions are then translated into 1's and 0's for the computer to understand through compilation.

So, if a parent were to say to a child,

"Clean your room."

The same command to a computer would be written like

package main

func main() {
    toys := []string{"Winnie the Pooh", "ring tower", "wooden blocks"}

You must explain what 'pickUp()' means with a young child.

So, you may tell your child,

"Pick up toy means to put it in the bucket so I can't see it anymore on the floor."

It's the same with a computer, but the language is much different.

package main

import "fmt"

func pickUp(toys []string) []string {
	for i, _ := range toys {
		toys[i] = ""
	return toys

func main() {
	toys := []string{"Winnie the Pooh", "ring tower", "wooden blocks"}
	done := pickUp(toys)
	fmt.Printf("All done: %v", done)

As you can see, talking to a computer requires a unique way of speaking, and each programming language has its way of doing so.

However, the structures and logic of how to do so are similar across most modern-day languages.

If you stick with this book, you can learn another language relatively quickly.

What is GO and why use GO?

The GO or GoLang programming language is young compared to its peers. It started at Google in about 2007 and was made public around 2009. Google created the language to solve their problems: maintaining codebases millions of lines long and quickly getting new hires up to speed without much experience. Hence, GO was created as a simple but powerful language that newbies could use to write performant code without much deep thought.

However, if you search around on the internet, you might end up confused and overwhelmed. Many users of GO aren't first-time programmers, and you'll often find very technical discussions around language design and "proper" GO. Here we'll keep it simple and not get into the weeds about what is good or bad in a language's design.

GO is gaining traction because you can write it on whichever type of computer you enjoy and compile it to run on any other computer. This is also called portability, a very useful feature for a language. It means that all the GO programs you write as you follow along with this book or create on your own can be used on any computer you may use at work.

Lastly, an even better feature that GO has is the promise of backward compatibility, which means the code you write today will work with newer GO versions ten years from now.

These two features may not seem like a huge deal as a beginner, but once you learn another language, you'll see how incredibly rare they are.  

Don't worry, you're not too Old

Anyone at any age can learn to program. I didn't learn about programming until my junior of university when I needed to know it to do some geophysics homework that I barely got a passing grade on.

A year later, I worked as a software engineer in a DevOps role– a lot can happen if you stick with it.

What matters on your learning journey is learning when you're frustrated, tired, or need a break. Because it is almost impossible to learn anything in that state of mind– the science supports it, if you're interested, read this.

So, when you're feeling down on yourself, try this mantra:

"It's ok to feel dumb because my mind is stretching and growing."

This is a mantra I repeated to myself during my first few years of learning programming.

You don't need a lot of math

Although computer science was started by mathematicians wanting to do complex calculations, there's no need to be a mathematician.

You'll be fine if you can do basic arithmetic operations of plus and minus.

So if

1 + 1 = 2
33 - 11 = 22 
3 * 5 = 15
9 / 3 = 3 

doesn't hurt your brain too much, then you'll be more than fine to follow along with this book.

The more important skill is persistence and a willingness to keep trying different things. Although movies and tv like to show programmers as having it all together and coding solutions in 30 seconds, this is far from the truth.

Most programming is having an idea and testing it via trying to write working code, which involves many breaking things. But the nice thing about programming is that breaking means your program doesn't work. And you can edit the file and rerun it with no real-world consequences on your local computer.

Writing Software is a Creative Endeavor

Creating software is like writing a story. You have a blank page and a vague idea of how you want the story to end but may not know precisely how to get there. Programming is much the same way except more concrete. You have a task you want to automate and rigid language standards for getting there. There's no figurative language in programming. But there is still a sense of style. Most Devs will agree that you want to create software that almost any reader can understand. Thankfully, GO makes doing this much easier since it has made most of your stylistic choices.

As you'll soon learn

"Gofmt's style is nobody's favourite, but gofmt is everybody's favourite." - Go proverb

About this E-book

This book assumes you have zero programming knowledge and nothing about GO. So the first section of the e-book will cover the essentials, such as setting up your dev environment and a guide to GO.

The second section will be full of fun little programs showing the power of programming and give the reader plenty of inspiration for how programming can boost their day-to-day work life.

Part I. An intro to GO syntax

Chapter 1. Setting up your Dev env

Installing go and Confirming that Go works
with the obligatory 'hello world' program.

Chapter 2. Basics of GO

We'll focus on understanding the GO toolchain with commands like 'go mod', 'go fmt', 'go run', 'go build', 'go test',  and go variables, which all make a programmer's life easy.

Chapter 3. Flow Control

Here we'll focus on turning instructions in the English language into tasks in the Computer language using GO syntax like 'if', 'else', 'switch', and 'for'.

Chapter 4. Functions

This chapter will focus on how to define units of work to keep from repeating code chunks.

Chapter 5. Slices

The fundamental data structure in GO is used for storing things in a list-like fashion and all the useful commands around it.

Chapter 6. Maps and Structs

Advanced data structures in GO and how to use them to make your program cleaner.

Part II. Automating Work

Chapter 7. String Manipulation

Shows how to work with text data in programming. Think of text data as words contained with your word document editor. Commonly called 'string' type data.

Chapter 8. Regex

Chapter 9. Reading and writing files

Chapter 10. Massive File management

Chapter 11. Downloading internet pages

Chapter 12. Excelling with GO - working with Spreadsheets

Chapter 13. Working with PDF and Word documents

Chapter 14. Working with CSV and JSON

Chapter 15. Getting a Grip on Dating

Chapter 16. Automate E-mailing and Texting

Chapter 17. Edit PNG and JPEGs

Chapter 0. Introduction