Introduction I was working on a Go service that was going to be deployed into a managed Kubernetes (K8s) environment on GCP. One day I wanted to look at the logs in the staging environment and got access to the ArgoCD platform. In the process of trying to find the logs, I stumbled upon the YAML that described the deployment configuration for my service. I was shocked to see that the CPU limit was set to 250m.
Continue readingI have always appreciated the Go Team investing time on providing the community with the Go Tour. This website is designed to help developers get started in learning the Go programming language. The nice part of the website is that it provides an interactive environment where one can read, write, and run Go examples.
Since the first time I’ve navigated this tour, I’ve had a few problems. First, this tour is not comprehensive both in the number of examples and the content explaining the examples.
Continue readingIntroduction This year I set a personal goal of walking for a total of 1,000 kilometers and I’m proud to say I’m close to hitting that goal. I’ve been tracking all the different routes I take in an app named Strava. One nice feature of Strava is that the app provides access to the raw data in a format called GPX. Starva can visualize the route in their app, but I wanted to try and perform my own visualization.
Continue readingIntroduction Prior to coding in Go, I was writing software in C#. In C# enumerations can be declared and the associated type can be used in functions and as fields in a struct. The compiler won’t allow a value of the enumerated type to be passed or set that doesn’t belong to the defined set. This is something that I have missed since coding in Go.
Go doesn’t have enumerations and it can be a problem at times when you want type safety for a well-defined set of values.
Continue readingSeries Here are all the posts in this series about the slices package.
Binary Search Clip, Clone, and Compact Compare Contains, Delete, and Equal Introduction In the last post of this series, I discussed the Compare API from the slices package. In this post, I will share how the Contains, Delete, and Equal APIs work.
Contains The Contains API reports whether a specified value exists in a specified collection.
Listing 1
Continue readingSeries Here are all the posts in this series about the slices package.
Binary Search Clip, Clone, and Compact Compare Contains, Delete, and Equal Introduction In the last post of this series I discussed the Clip, Clone, and Compact APIs from the slices package. In this post, I will share how the Compare and CompareFunc APIs work.
Compare The Compare API can be used to compare two slices and determine if the slices are equal or which one is shorter.
Continue readingSeries Here are all the posts in this series about the slices package.
Binary Search Clip, Clone, and Compact Compare Contains, Delete, and Equal Introduction In the first post of this series, I discussed the binary search API from the slices package that is now part of the standard library with the release of version 1.21. In this post, I will share how the Clip, Clone, and Compact APIs work.
Continue readingSeries Here are all the posts in this series about the slices package.
Binary Search Clip, Clone, and Compact Compare Contains, Delete, and Equal Introduction Go’s most important data structure is the slice and it was designed from the beginning to be mechanically sympathetic with the hardware. To learn more about that, check out Bill Kennedy’s Ultimate Go video. Thanks to the introduction of generics in Go 1.18, the language team has been experimenting with a new package called slices.
Continue readingIntroduction When a CPU needs to access a piece of data, the data needs to travel into the processor from main memory.
The architecture looks something like this:
Figure 1: CPU Cache
Figure 1 shows the different layers of memory a piece of data has to travel to be accessible by the processor. Each CPU has its own L1 and L2 cache, and the L3 cache is shared among all CPUs.
Continue readingApril 3, 2023Ardan Labs
From the Ardan Community
Introduction In episode 9, Miki discussed how a command flag can be decoded into a user defined type with the Value interface. As a recap, the Value interface consists of two methods: one for serializing the underlying concrete type and one for deserializing a string into an object. To put this interface to the test, Miki wrote a command that had a flag to specify a network address. While implementing the Set method of the Value interface, Miki demonstrated how to add validation for your program’s flags.
Continue reading