April 15, 2024Ardan Labs
From the Ardan Community
Introduction Rust’s memory safety features are advantageous to Rust developers because they:
Ensure robust protection against buffer overflows and underflows, enhancing the reliability and security of software.
Empower developers to manage type coercion effectively, promoting code reliability and safety while facilitating safe type conversions.
Provide confidence in writing concurrent code by enforcing strict mutability rules and synchronization, thereby preventing data race issues and ensuring code correctness and efficiency.
With these memory safety features deeply integrated into Rust’s design, developers can build more reliable, secure, and efficient software, spanning various aspects of memory management, type handling, and concurrent programming paradigms.
Continue reading Introduction In my previous post, I discussed the current state of looping in Go. In this post, we’re going to look into a future feature for the Go programming language called range-over function experiment. Go lacks a standard iterator protocol and this is an attempt to provide one. We’ll discuss the motivation for adding this new feature and see some examples on how to use it.
NOTE: In order to run the code, you need to set the GOEXPERIMENT environment variable to rangefunc (e.
Continue readingIntroduction Looping seems like a basic topic: Write a for loop with a termination condition, and you’re done. However there’s a lot of ways you can write a for loop in Go. Knowing more about the different versions of for will help you choose the best option to accomplish your tasks and it will help you prevent some bugs.
Some Assembly Required What kind of code is generated by the compiler for a for loop?
Continue readingIntroduction After writing the Kubernetes (K8s) CPU Limits post, I was wondering what happens when a K8s memory limit is set for the same service. I’ve been hearing at workshops and at Ardan how people are experiencing Out Of Memory (OOM) problems with their PODs when setting K8s memory limits. I’m often told that when an OOM occurs, K8s will terminate and restart the POD.
I wanted to experience an OOM, but I was also curious about three other things.
Continue readingIntroduction 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 reading