If you are transitioning into Go from a language like Python or Ruby, at some point or another you are going to start missing one of the many helper functions offered by the language. The most recent example of this for me was when I wanted to shuffle a slice. In Ruby this is as simple as calling the shuffle method. array = [1, 2, 3, 4, 5] array.shuffle # shuffles the array!
In this post we discuss what causes some changes to slices to be persisted even when they are passed by value, why this ultimately happens, and how to avoid it.
Learn about the difference between capacity and length and how to properly utilize them to make your Go code faster, cleaner, and memory efficient.
Sign up for my mailing list and I'll send you a FREE sample from my course - Web Development with Go. The sample includes three chapters from the book, and over 2.5 hours of screencasts.
You will also receive notifications when I release new articles, along with other freebies that I only share with my mailing list.
Jon Calhoun is a full stack web developer who also teaches about Go, web development, algorithms, and anything programming related. He also consults for other companies who have development needs. (If you need some development work done, get in touch!)
Jon is a co-founder of EasyPost, a shipping API that many fortune 500 companies use to power their shipping infrastructure, and prior to founding EasyPost he worked at google as a software engineer.
©2018 Jonathan Calhoun. All rights reserved.