Black Friday Sale: Get 40% off all our Training Bundles! View Bundles →
Ardan Labs

Golang
Blog Posts

Provident cupiditate voluptatem et in. Quaerat fugiat ut assumenda excepturi exercitationem quasi. In deleniti eaque aut repudiandae et a id nisi.

Subscribe to our Newsletter

By signing up you get access to our FREE Training Bundle, Technical Tuesday releases, Special Offers, & Notifications on our latest content.

Posts tagged with "Golang"

Oct 21, 2025

go training golang

Understanding how your data structures interact with hardware is one of the most powerful ways to improve application performance. This blogpost explores how CPU caches influence speed and how thoughtful struct design in Go can yield massive gains. …

Sep 22, 2025

go training golang

Kubernetes CPU limits can look straightforward on the surface, but their impact on application performance is anything but simple. This article unpacks how Go services interact with Kubernetes CPU throttling and why a seemingly harmless configuration …

Aug 26, 2025

go Training golang

Go’s garbage collector is designed not only to manage memory safely but also to pace itself intelligently, striking a balance between low latency and high throughput. This blogpost explores how the GC adapts its pace to workload demands, demonstrated …

Jul 14, 2025

go Training golang

Originally published in 2019, this article is part two of a three-part series exploring Go’s garbage collector. Though the Go runtime has continued to evolve, the performance principles covered here remain highly relevant today. This installment …

Jun 10, 2025

go Training golang

This article was originally published in 2018, yet its core insights into Go’s garbage collection model remain highly relevant for developers today. While some implementation details of Go’s runtime have evolved, the foundational concepts explored …

May 19, 2025

golang json

Introduction In part 1 we took a higher level view on serialization in general and JSON in specific. In part 2 we looked at emitting JSON. In part 3, we’ll look at an issue you might encounter when consuming JSON, Zero vs NULL field values. To …

May 12, 2025

go Training golang

Although originally written in 2018, the following concepts remain essential for developers working with concurrency. This blogpost focuses on concurrency, distinguishing it from parallelism by defining it as “out of order” execution. It …

Apr 14, 2025

go Training golang

This blogpost is the second installment in a three-part series exploring the mechanics and semantics of the Go scheduler. Despite being published in 2018, the content remains relevant today, as the Go scheduler’s design continues to influence …

Mar 4, 2025

go Training golang

Although this blogpost was originally published in 2018, the concepts and principles discussed remain crucial for building efficient and performant multithreaded applications in Go now in 2025 (Go 1.24.0). As the Go ecosystem continues to evolve, …

Feb 10, 2025

go Training golang

Although first introduced in 2014, the Context package remains a crucial component of Go programming, enabling efficient management of request-scoped data, deadlines, and cancellation signals. As the Go ecosystem continues to evolve, understanding …

Feb 4, 2025

golang json

Introduction In part 1 we took a high-level view on serialization and JSON. In this part, we’ll roll our sleeves and start working with JSON, focused on emitting JSON. You might think this is a basic topic, but there is much more to it than …

Oct 23, 2024

golang json

Introduction Everybody knows JSON, it’s a simple serialization format and the default format for REST APIs. Like many other topics, there are fine points you should know in order to work with JSON more effectively and avoid common mistakes. In …

Apr 15, 2024

go training golang rust

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 …

Apr 9, 2024

golang javascript

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 …
In our series of articles on recruitment, we have talked about engineers in Latin America such as Brazil, Mexico and Argentina, we also talked about the skills of engineers who come from the USA and Canada. Now it’s Europe’s turn. The …

Mar 12, 2024

golang javascript

Introduction 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 …
For numerous organizations, acquiring engineering talent can present significant challenges, particularly when relying on conventional sourcing methods. Scouring job websites or relying on recruiters who may not fully understand your technology stack …

Feb 27, 2024

go training golang

Introduction 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 …
You need engineering resources and you’re back to the same old ways you’ve always used to find someone. Maybe you’re using a job website or working with the same old recruiter who has never understood your tech stack or real needs. In any case, …
About GopherCon Europe As Go’s popularity soared, GopherCon went global and GopherCon Europe (GCEU) kicked off its inaugural conference in 2018 in Reykjavik, Iceland. After that, GCEU had plans to rotate the conference every year in different …
The Role of Qualified Engineers in Shaping Future of Modern Enterprises The engineers - the superheroes with a knack for problem-solving, creative thinking, and adaptability fuel businesses to stay ahead in the fast-paced tech landscape. Investing in …
In the fast-paced world of corporate dynamism, every company seeks the perfect moves to amp up efficiency, slash costs, and emerge as the undisputed champion. Enter the secret weapon: Staff Augmentation. What’s the Buzz About Staff …

Jan 15, 2024

go training golang

I 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 …

Jan 10, 2024

Go Golang Nearshoring

Nearshoring success? How do we make it happen? For many companies, choosing between nearshoring and offshoring becomes tricky. Nevertheless, there are numerous success stories associated with nearshoring. This case study explores the successes of a …

Nov 23, 2023

golang javascript

Introduction 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 …
Go-Powered Transformation: Ardan Labs Fintech Consulting Success Story In today’s fast-paced and highly competitive financial services industry, streamlined software development can be a game-changer for companies aiming to stay ahead of the …

Sep 21, 2023

go training golang

Introduction 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 …

Sep 8, 2023

go training golang

Series 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 …

Aug 25, 2023

go training golang

Series 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 …

Aug 18, 2023

go training golang

Series 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 …

Aug 2, 2023

go training golang

Series 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 …

Apr 3, 2023

go training golang

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 …

Mar 27, 2023

go training golang

Introduction In episode 8, Miki developed a Go HTTP client that had a method to check the health of a theoretical API. The method would construct the request URL and return an error based on the response code received from the server. Miki then …

Mar 20, 2023

go training golang

Introduction In episode 7, Miki discussed design considerations to keep in mind while creating interfaces in Go with the first idea he proposed being that an interface should represent what we need from a type, and not what is stored on the type. To …

Mar 13, 2023

go training golang

Introduction In episode 6, Miki built a logger package with the aim of making it as versatile as possible. To achieve this, he constructed his logger object with a function that would: accept the io.Writer interface as a parameter and perform type …

Mar 9, 2023

golang

Introduction One of the exercises I give to students is to download a single big file over HTTP concurrently using several goroutines using HTTP Range requests. An extra part of the exercise is to validate the downloaded file from a known MD5 …

Mar 7, 2023

go training golang

Introduction In episode 5, Miki wrote a function that counted the number of lines in a file with interfaces. The first thing his function did was to open a file with Go’s os.Open function. Miki chose this method because the variable returned by said …

Feb 27, 2023

go training golang

Introduction In episode 4, Miki defined an enumerated type that satisfied Go’s fmt.Stringer interface. By implementing the fmt.Stringer interface, Miki can specify how his enumerators were printed within a formatted string and in this case, he …

Feb 21, 2023

go training golang

Introduction In episode 3, Miki implemented a type that satisfied Go’s error interface. The odd thing about his type was it would be considered not-nil although no value was set for it. To get a better understanding of the situation, Miki gives a …

Feb 13, 2023

go training golang

Introduction In episode 2, Miki examined the impact interfaces have on the performance of a Go program. To perform this experiment, Miki invoked a type’s method in two ways: with the concrete type and as an interface function to measure the …

Feb 8, 2023

go training golang

Introduction In episode 1, Miki had two functions that performed the similar operation, but returned different types. To refactor this, Miki rewrote both functions as a generic function that allowed him to specify the type to be returned during …

Jan 31, 2023

go training golang

Introduction Go interfaces are beneficial to Go developers because they: Allow interfaces to separate mechanism from behavior. Increase flexibility of function parameters. Enable mocking of function parameters. With the addition of generics in Go …
Introduction In episode 19, Bill designed and implemented the data structure for an account on his blockchain. This type will have a nonce field to ensure incoming transactions are valid and performed in order. Since the database will be stored in …
Introduction In episode 17, Bill began to design an in-memory accounting database that will store the account balances on his blockchain. To build this database, Bill will add a memory pool on each node that stores a list of public addresses with …
Introduction In episode 18, Bill defined the Go type that will represent a transaction and implemented the methods to validate one. While developing the transaction type, Bill states that he’ll be borrowing concepts from Ethereum to ensure that he’s …

Jan 19, 2023

go training golang

Introduction Table tests are a great way to test different inputs and associated outputs for a function in Go. To write a table test, you define a slice of some data struct with fields of the input data you’ll need and the expected outcome. Then you …
Introduction In episode 16, Bill implemented additional means of verification for his blockchain’s transactions. The first update he made was to verify if a transaction is destined for his blockchain by reading the first byte of the signature. The …
Introduction In episode 15, Bill architected a solution to ensure all the users on his blockchain were given a unique identifier. His approach consisted of essentially leveraging the randomness of a user’s private key to ensure each identifier …

Jan 17, 2023

go training golang

Introduction When an API requires implementation details from the user, many developers use an interface for help. However, another way to allow developers to provide implementation details for an API is to accept a function instead. Go supports …

Jan 12, 2023

go training golang

Introduction In episode 14, Bill architected a solution to digitally sign the transactions on his blockchain. His solution retrieved the private key by : loading private key data from disk, parsing the key data and returning the ECDSA private key. …

Jan 12, 2023

go training golang

Introduction Google developed Go to be an alternative to C++ with the internet and scale in mind. Go’s toolchain automates tasks that are easily overlooked, and amongst those tasks is generating documentation. Go has the ability to generate …

Jan 11, 2023

go training golang

Introduction In episode 12, Bill laid out his strategy to handle data hashing on his blockchain. The first step he took was to create a package to handle the cryptographical aspects of his blockchain. After that, he wrote a hash function that met the …

Jan 11, 2023

go training golang

Introduction In episode 13, Bill discussed the idea of adding salt to a hash and how modern crypto-currency blockchains use it to better interpret requests sent to nodes. He continued by defining a function called stamp that embeds a salt within a …

Jan 4, 2023

go training golang

Introduction In episode 11, Bill highlighted the issue of identity verification and provided a solution to this problem. The solution proposed was to cryptographically sign a transaction to verify its authenticity. Bill chose to implement a solution …

Jan 3, 2023

go training golang

Introduction In episode 9, Bill introduced the idea of the genesis record and its role in his blockchain. As a recap, the genesis record will be used to customize the settings of his blockchain. The approach Bill takes here is similar to how Ethereum …

Jan 3, 2023

go training golang

Introduction In episode 10, Bill dove into the technical implementation of his genesis record and defined a custom Go type representing the record. While doing so, he provided an in-depth look at the reasoning behind the fields he included.. After …
Introduction I made it my mission in 2022 to learn everything I could about blockchain and as the year ends, I feel like I accomplished my goal. Love it, hate it, or don’t want to know nothing about it, I think it’s important to push your opinions …

Dec 20, 2022

go training golang

Introduction In episode 8, Bill wanted to build a blockchain in Go and began to lay the groundwork for the project. Go is a good choice because its standard library has the necessary network and cryptographical functionality required to build a …

Dec 19, 2022

go training golang

Introduction In episode 6, Bill gives an overview of what consensus algorithms are and how these algorithms ensure distributed databases are in sync. Moving forward Bill will adopt the proof of authority (PoA) algorithm as a means to determine which …

Dec 19, 2022

go training golang

Introduction In the first part of the series, Bill designed a dependency management system. The dependency manager needed to be distributed, transparent, cryptographically auditable and scalable. To meet these requirements, Bill borrowed concepts …

Dec 16, 2022

go training golang

Introduction In this video, Paulo shows the benefit of leveraging generic functions to write less code that does more. He starts by walking you through an API server he initially wrote that makes use of Go’s default HTTP handlers with a sprinkle of …

Dec 16, 2022

go training golang

Introduction In case you missed episode 4, Bill attempted to integrate current database sharing solutions to solve the “database ownership” problem his dependency manager faces. He tried providing copies of the database, implementing a load balancer …

Dec 16, 2022

go training golang

Introduction In the last video, Bill left off talking about proof of work (PoW) algorithms. In a distributed and decentralized environment, PoW used to be the gold standard for a node to participate equitably in a Blockchain. However, with PoW as the …

Dec 16, 2022

go training golang

Introduction Most apps that work with time values eventually need to display time to a user. Go has a unique way of allowing you to specify how to display time values that is different from the C library function strftime. The strftime function tends …

Dec 14, 2022

go training golang

Introduction In episode 2, Bill designed a database for his dependency manager to enable Go developers to have reproducible,durable and secure builds. This database will house the hash value for each of the dependencies stored. During runtime, these …

Dec 14, 2022

go training golang

Introduction In episode 3, Bill needed to figure out how to share ownership of his dependency manager’s database in a secure and efficient manner. Bill is the only stakeholder with full access to his dependency manager’s database. That is, he is the …

Dec 13, 2022

go training golang

Introduction In episode 1, Bill finished by describing the dependency management conundrum Go faced in its early days. Prior to the Go team providing the module system, developers were on their own to find a solution. Engineers in the Go community …

Dec 12, 2022

go training golang

Introduction In this video, Bill will introduce the concepts of what a blockchain is, the benefits of a blockchain, and the network environment it operates in. Bill describes a blockchain as a single, append-only, transparent, publicly available and …
Introduction A blockchain is an integrated solution of different computer science problems in the form of a single, append-only, publicly available, transparent, and cryptographically auditable database that runs in a distributed and decentralized …
Introduction In the first three posts, I explained there were four aspects of a blockchain that this series would explore with a backing implementation provided by the Ardan blockchain project. Digital accounts with electronic signatures and …
Introduction In the first two posts, I explained there were four aspects of a blockchain that this series would explore with a backing implementation provided by the Ardan blockchain project. Digital accounts with electronic signatures and …
Introduction In the first post, I explained there were four aspects of a blockchain that this series would explore with a backing implementation provided by the Ardan blockchain project. Digital accounts with electronic signatures and verification …
Introduction This is the first post in a series that will explore the semantics and implementation details of the Ardan blockchain project. The code is a reference implementation of a blockchain and not intended to mirror any specific blockchain in …

Jan 17, 2022

golang

Introduction You’d like to visualize some stock data using Go, but after looking at the Go ecosystem you see very little in charting. You find gonum, which has some plotting capabilities, but it generates static charts. It’s 2022, and …

Nov 1, 2021

golang

Introduction You are jogging and want to show off your route to your friends. Let’s imagine the data you have for your route is a CSV file in the following format: Listing 1: track.csv time,lat,lng,height 2015-08-20 …

Sep 13, 2021

golang

Introduction You are about to visit Boston, and would like to taste some good food. You ask your friend who lives there what are good places to eat. They reply with “Everything is good, you can’t go wrong”. Which makes you think, …

Jul 27, 2021

golang

The Question When you work on data science problems, you always start with a question you’re trying to answer. This question will affect the data you pick, your exploration process, and how you interpret the results. The question for this …

Apr 9, 2021

golang

Introduction You write a server for a massively multiplayer online role-playing game (MMORPG). In the game, players collect keys and you want to design how to store the set of keys each player has. As an example, imagine the set of keys are copper, …

Jan 13, 2021

python grpc golang

Introduction If you can write a for-loop, you can do statistics. - Jake Vanderplas A lot of developers shy away from problems which involve statistics or probability. Which is shameful since in today’s data-rich environment, you can gain a lot …

Nov 30, 2020

python grpc golang

Introduction I prefer to use relational (SQL) databases in general since they provide several features that are very useful when working with data. SQLite is a great choice since the database is a single file, which makes it easier to share data. …

Nov 2, 2020

python grpc golang

Introduction Every single company I’ve worked at and talked to has the same problem without a single exception so far - poor data quality, especially tracking data. Either there’s incomplete data, missing tracking data, duplicative …

Sep 29, 2020

go Training golang

Series Index Generics Part 01: Basic Syntax Generics Part 02: Underlying Types Generics Part 03: Struct Types and Data Semantics Introduction In the previous post, I showed you how to declare a user-defined type, based on an underlying type. I did …

Sep 15, 2020

go python grpc golang

Series Index Python and Go: Part I - gRPC Python and Go: Part II - Extending Python With Go Python and Go: Part III - Packaging Python Code Python and Go: Part IV - Using Python in Memory Introduction In a previous post we used gRPC to call Python …

Aug 27, 2020

Go Caddy Golang

Ardan Labs partnership with Caddy Server has led to the acquisition of the popular free open-source web server platform by Apilayer. http://www.prweb.com/releases/caddy_server_acquired_by_apilayer/prweb17367009.htm Ardan Labs announces they have …

Aug 18, 2020

go Training golang

Changes The draft is a living document which means these posts will need to change over time. This section documents when changes have taken place to this post. 21/08/20 : Moving forward with the generics design draft Series Index Generics Part 01: …

Aug 11, 2020

go python grpc golang

Series Index Python and Go: Part I - gRPC Python and Go: Part II - Extending Python With Go Python and Go: Part III - Packaging Python Code Python and Go: Part IV - Using Python in Memory Introduction In the previous post we compiled Go code to a …

Jul 23, 2020

go Training golang

Changes The draft is a living document which means these posts will need to change over time. This section documents when changes have taken place to this post. 21/08/20 : Moving forward with the generics design draft Series Index Generics Part 01: …

Jul 6, 2020

go python grpc golang

Series Index Python and Go: Part I - gRPC Python and Go: Part II - Extending Python With Go Python and Go: Part III - Packaging Python Code Python and Go: Part IV - Using Python in Memory Introduction In the previous post we saw how a Go service can …
Introduction In this paper written by Manish Jain (the founder of Dgraph) he describes Dgraph as: a distributed graph database which provides horizontal scalability, distributed cluster-wide ACID transactions, low-latency arbitrary-depth joins, …

Jun 8, 2020

go python grpc golang

Series Index Python and Go: Part I - gRPC Python and Go: Part II - Extending Python With Go Python and Go: Part III - Packaging Python Code Python and Go: Part IV - Using Python in Memory Introduction Like tools, programming languages tend to solve …
Introduction In most of the reviews for this post, I was asked why choose a graph database over something else? This is a hard question to answer since my experience right now is limited on the graph database side. My guess is you’re wondering the …
Introduction I have spent a career building business applications that work with databases, starting with SQL and then moving to No-SQL. I’ve been curious how Graph databases work and how to build applications with them. It seems the sweet spot for a …

Apr 13, 2020

go Training golang

Series Index Why and What Projects, Dependencies and Gopls Minimal Version Selection Mirrors, Checksums and Athens Gopls Improvements Vendoring Introduction It’s no secret that I am a fan of vendoring when it’s reasonable and practical to use it for …

Apr 8, 2020

go Training golang

Series Index Why and What Projects, Dependencies and Gopls Minimal Version Selection Mirrors, Checksums and Athens Gopls Improvements Vendoring Prelude This is a guest post written by Rohan Challa, a member of the Go team working on gopls. This …

Apr 3, 2020

go Training golang docker

Series Index Reducing Image Size Details Specific To Different Languages Going Farther To Reduce Image Size Introduction In the first two parts of this series, we covered the most common methods to optimize Docker image size. We saw how multi-stage …

Feb 24, 2020

go Training golang docker

Series Index Reducing Image Size Details Specific To Different Languages Going Farther To Reduce Image Size Introduction In the first part, we introduced multi-stage builds, static and dynamic linking, and briefly mentioned Alpine. In this second …

Feb 10, 2020

go Training golang

Series Index Why and What Projects, Dependencies and Gopls Minimal Version Selection Mirrors, Checksums and Athens Gopls Improvements Vendoring Introduction One of the longer standing questions I had when first learning about modules was how the …

Feb 4, 2020

go Training golang docker

Series Index Reducing Image Size Details Specific To Different Languages Going Farther To Reduce Image Size Introduction When getting started with containers, it’s pretty easy to be shocked by the size of the images that we build. We’re …

Dec 18, 2019

go Training golang

Series Index Why and What Projects, Dependencies and Gopls Minimal Version Selection Mirrors, Checksums and Athens Gopls Improvements Vendoring Introduction Every dependency management solution has to solve the problem of picking a version of a …

Dec 2, 2019

go Training golang

Series Index Why and What Projects, Dependencies and Gopls Minimal Version Selection Mirrors, Checksums and Athens Gopls Improvements Vendoring Introduction Modules is the system integrated into Go to provide support for dependency management. This …

Nov 16, 2019

go Training golang

“Flutter and Fuchsia. In 2019 you will see these two words everywhere, and now is your chance to get ahead of the curve.” - Todd Fabacher, writing for Forbes Forbes saw it coming back in July of 2018. If you didn’t, then here’s your chance to find …

Oct 10, 2019

go Training golang

Series Index Why and What Projects, Dependencies and Gopls Minimal Version Selection Mirrors, Checksums and Athens Gopls Improvements Vendoring Introduction Modules provide an integrated solution for three key problems that have been a pain point for …
Integration tests give insights to the end-to-end operation of web services. In part 2 of this 2 part series over integration testing in Go we explore how to configure and manage external systems before and during testing as well as the actual act of writing integration tests.

Aug 26, 2019

go Training golang devops

1. What are four keys for great DevOps? Collaboration: DevOps requires collaboration, both within teams and between teams. Good communication between teams implies to break down silos, which can be harder than it sounds in organizations where a …

Jul 22, 2019

go Training golang

Ardan Labs (a leader in building Go enterprise software) is excited to announce that we have partnered with Light Code Labs and Matt Holt to bring Caddy into the Ardan Labs family of products and services. Caddy is a lightweight ingress service …

Jul 1, 2019

go Training golang

“Once a language gets complex enough, programming in it is more like carving out a subset from an infinite sea of features, most of which we’ll never learn. Once a language feels infinite, the costs of adding further features to it are no longer …

May 28, 2019

Go Training Golang

Ardan Labs will work with the Caddy team on bringing a highly functional enterprise version to market Caddy Enterprise We have recently agreed on terms for a partnership which will allow us to develop Caddy side-by-side with the founding team. Caddy …

Apr 18, 2019

go Training golang

One of the traps of concurrency is “incomplete work” which occurs when a program terminates before outstanding Goroutines complete. Depending on the program, this may be a serious problem. This post demonstrates the trap and discusses possible solutions.
Integration tests give insights to the end-to-end operation of web services. In part 1 of this 2 part series over integration testing in Go we explore how to run integration tests in restrictive environments, such as Jenkins.

Dec 19, 2018

go Training golang

Goroutine Leaks are a common cause of memory leaks in Go programs. In my previous post, I presented an introduction to Goroutine leaks and provided one example of a common mistake that many Go developers make. Continuing that work, this post presents another scenario on how Goroutines could be leaked.

Nov 12, 2018

go Training golang

Goroutine leaks are a common source of memory leaks in concurrent programs. This post defines Goroutine leaks and provides one example of a leak that is easy to miss in production code.

Jun 27, 2018

go Training golang

Introduction I teach a class called Ultimate Go. The class is three days long and teaches you the history, mechanics and semantics of the Go programming language. The idea is to teach you how to read code to the level that you can understand the …

Apr 28, 2018

go Training golang

Introduction One day I was talking to Damian Gryski in Slack about some performance improvements he made to his go-metro package. When I first looked at the changes I was completely confused how this could have any effect on the performance of the …

Mar 23, 2018

go Training golang

Introduction I’ve been seeing a lot of question about interfaces lately on Slack. Most of the time the answers are technical and focus on implementation details. Implementation is important to help with debugging, but implementation doesn’t help with …

Feb 20, 2018

go Training golang

Introduction I was guided for many years to write functions that are generalized and to create layers upon layers of abstraction so things don’t break as business requirements change. That the cost of breaking a function signature, for example, is …

Jan 22, 2018

go Training golang

Prelude It will be helpful to read this four-part series first on escape analysis and data semantics. Details on how to read an escape analysis report and pprof output have been outlined here. …

Oct 24, 2017

go Training golang

Introduction When I started to work with Go’s channels for the first time, I made the mistake of thinking about channels as a data structure. I saw channels as a queue that provided automatic synchronized access between goroutines. This structural …

Jul 15, 2017

go Training golang

Prelude If you want to put this post in some better context, I suggest reading the following series of posts, which lay out some other fundamental and relevant design principles: Language Mechanics On Stacks And Pointers Language Mechanics On Escape …

Jun 27, 2017

go Training golang

Prelude These are good posts to read first to better understand the material presented in this post: Index of the four part series: Language Mechanics On Stacks And Pointers Language Mechanics On Escape Analysis Language Mechanics On Memory Profiling …

Jun 8, 2017

go Training golang

Prelude This is the final post in a four part series discussing the mechanics and design behind pointers, stacks, heaps, escape analysis and value/pointer semantics in Go. This post focuses on data and the design philosophies of applying …

Jun 1, 2017

go Training golang

Prelude This is the third post in a four part series that will provide an understanding of the mechanics and design behind pointers, stacks, heaps, escape analysis and value/pointer semantics in Go. This post focuses on heaps and escape analysis. …

May 26, 2017

go Training golang

Prelude This is the second post in a four part series that will provide an understanding of the mechanics and design behind pointers, stacks, heaps, escape analysis and value/pointer semantics in Go. This post focuses on heaps and escape analysis. …

May 18, 2017

go Training golang

Prelude This is the first post in a four part series that will provide an understanding of the mechanics and design behind pointers, stacks, heaps, escape analysis and value/pointer semantics in Go. This post focuses on stacks and pointers. Index of …

May 10, 2017

go Training golang

Prelude This post is part of a series designed to make you think about your own design philosophy on different topics. If you haven’t read the following post yet, please do so first: Develop Your Design Philosophy Introduction Systems cannot be …

Feb 24, 2017

go Training golang

Updated on February 28th, 2017 Prelude This post is part of a series of posts designed to make you think about your own design philosophy on different topics. If you haven’t read these posts yet, please do so first: Develop Your Design Philosophy …

Feb 20, 2017

go Training golang

Prelude This post is part of a series of posts designed to make you think about your own design philosophy on different topics. If you haven’t read this post yet, please do so first: Develop Your Design Philosophy After this post, read this next one: …

Feb 7, 2017

go Training golang

Updated on February 10th, 2017 Prelude This post is part of a series of posts designed to make you think about your own design philosophy on different topics. If you haven’t read this post yet, please do so first: Develop Your Design Philosophy …

Jan 31, 2017

go Training golang

Prelude This post is part of a series of posts designed to make you think about your own design philosophy on different topics. I will not be laying out direct examples to prove my own thoughts and ideas. It takes me two or three days in the …

Dec 5, 2016

go Training golang

This is a talk that I gave at the Vancouver Meetup on November 29th, 2016. The talk covers topics around developing your own design philosophy with a focus on decoupling from change. These are things I cover extensively in the Ultimate Go Classes. …

Nov 3, 2016

go Training golang

“I think it’s ok to do heinous stuff to test an API if it makes it more usable by others.” - Nate Finch Prelude If you are new to Go, it might help to read these posts first before continuing on with this post. …

Oct 21, 2016

go Training golang

Introduction Interfaces should only be used when their added value is clear. I see too many packages that declare interfaces unnecessarily, sometimes just for the sake of using interfaces. The use of interfaces when they are not necessary is called …

Oct 9, 2016

go Training golang

Introduction I see a lot of developers coming to Go from object oriented programming languages such as C# and Java. Because these developers have been trained to use type hierarchies, it makes sense for them to use this same pattern in Go. However, …

May 12, 2016

go Training golang

Introduction If you are new to Linux or the Mac you might find installing Go to be a bit confusing. It was for me when I started learning Go. Go was the reason I stopped using Windows, which I used for 20 years. Even if you’re experienced with …

May 5, 2016

go Training golang

I am constantly thinking about the Go language and how things work. Lately I have been thinking how everything in Go is by value. We see this when we pass values to functions, when we iterate over slices and when we perform type assertions. In every …

Sep 13, 2015

go Training golang

Composition goes beyond the mechanics of type embedding. It’s a paradigm we can leverage to design better APIs and to build larger programs from smaller parts. It all starts from the declaration and implementation of types that have a single …

Mar 15, 2015

go Training golang

Go is an object oriented programming language. It may not have inheritance, but in this 20 minute video from the Bangalore meetup, I will show you how object oriented programming practices and techniques can be applied to your Go programs. From an …

Feb 23, 2015

go Training golang

Introduction One of the things I love about Go is the profiling and debug information you can generate. There is a special environmental variable named GODEBUG that will emit debugging information about the runtime as your program executes. You can …

Jan 11, 2015

go Training golang

Introduction Having some basic skills in debugging Go programs can save any programmer a good amount of time trying to identify problems. I believe in logging as much information as you can, but sometimes a panic occurs and what you logged is not …

Dec 16, 2014

go Training golang

Introduction I am asked quite a bit about when and when not to use pointers in Go. The problem most people have, is that they try to make this decision based on what they think the performance tradeoff will be. Hence the problem, don’t make coding …

Nov 10, 2014

go Training golang

Introduction In part I of this post, we learned about the error interface and how the standard library provides support for creating error interface values via the errors package. We also learned how to work with error interface values and use them …

Oct 13, 2014

go Training golang

Introduction It is idiomatic in Go to use the error interface type as the return type for any error that is going to be returned from a function or method. This interface is used by all the functions and methods in the standard library that return …

Sep 1, 2014

go Training golang

Introduction I was thinking about how the compiler looks to protect the code we write when it can. Invalid memory access checks are one type of safety check the compiler adds to our code. We might think that this "extra code" is hurting our …

Aug 30, 2014

go Training golang

If you have not heard about the ALS Ice Bucket Challenge I would be surprised. It’s everywhere nowadays, being done by celebrities alike. After being challenged by my children there was only one person, or should I say Gopher, I knew I needed …

Jun 27, 2014

go Training golang

Introduction Dave Cheney published a post called Ice Cream Makers and Data Races. The post showed an example of an interesting data race that can occur when using an interface typed variable to make a method call. If you have not read the post yet …

Jun 25, 2014

go Training golang

Introduction If you are building any kind of application for a consumer based product, it is common to have large amounts of application data being generated about your users. Running reports is a traditional use of this data, but what if you could …

Jun 20, 2014

go Training golang

Introduction Closures in Go are a very powerful construct but they can also be the cause of bugs if you don’t understand how they work. In this post I am going to pull a small piece of code from Chapter 2 from the Go In Action book that discusses a …

May 3, 2014

go Training golang

Introduction My business partner Ed asked me what would happen if a struct and an embedded field both implemented the same interface. We asked ourselves two questions: Would the compiler throw an error because we now had two implementations of the …

Apr 6, 2014

go Training golang

Introduction One of the more unique features of Go is how the language implements constants. The rules for constants in the language specification are unique to Go. They provide the flexibility Go needs at the compiler level to make the code we write …

Mar 15, 2014

go Training golang

Introduction One of the first things I learned about in Go was using an uppercase or lowercase letter as the first letter when naming a type, variable or function. It was explained that when the first letter was capitalized, the identifier was public …

Mar 7, 2014

go Training golang

Introduction As I improve my knowledge and framework for a Go based web service I am building, I continue to go back and enhance my Beego Sample App. Something I just added recently was providing localized messages for validation errors. I was …

Feb 25, 2014

go Training golang

If you are attending GopherCon 2014 or plan to watch the videos once they are released, this article will prepare you for the talk by Gustavo Niemeyer and Steve Francia. It provides a beginners view for using the Go mgo driver against a MongoDB …

Feb 17, 2014

go Training golang

Introduction In my last post called Concurrency, Goroutines and GOMAXPROCS, I set the stage for talking about channels. We discussed what concurrency was and how goroutines played a role. With that foundation in hand, we can now understand the …

Jan 29, 2014

go Training golang

Introduction When new people join the Go-Miami group they always write that they want to learn more about Go’s concurrency model. Concurrency seems to be the big buzz word around the language. It was for me when I first started hearing about …

Jan 21, 2014

go Training golang

Introduction We are working on a project where we have to make calls into a web service. Many of the web calls return very large documents that contain many sub-documents. The worst part is, we usually only need a handful of the fields for any given …

Jan 16, 2014

go Training golang

Gopher Academy announced a great program today. Today I’d like to announce the GopherCon Scholarship Program. It’s goal is to increase the visibility of women in the Go community through the most direct path I can imagine: sponsoring …

Jan 16, 2014

go Training golang

Introduction In October 2013 I sent out a call to action to the Go community. I wanted to form a group of Gophers that would come together and help write a specification and build a working implementation of a package management tool. We are not …

Dec 31, 2013

go Training golang

Introduction There are lots of posts that talk about the internals of slices, but when it comes to maps, we are left in the dark. I was wondering why and then I found the code for maps and it all made sense. https://golang.org/src/runtime/hashmap.go …

Dec 20, 2013

go Training golang

Introduction The first thing I did when I started programming in Go was begin porting my Windows utilities classes and service frameworks over to Linux. This is what I did when I moved from C++ to C#. Thank goodness, I soon learned about Iron.IO and …

Dec 17, 2013

go Training golang

With the release of Go 1.2, slices gained the ability to specify the capacity when performing a slicing operation. This doesn’t mean we can use this index to extend the capacity of the underlying array. It means we can create a new slice whose …

Dec 11, 2013

go Training golang

Introduction I am very excited about the Beego web framework. I wanted to share with you how I use the framework to build real world web sites and web services. Here is a picture of the sample website the post is going to showcase: The sample web …

Dec 10, 2013

go Training golang

At Ardan Studios we have spent the last 6 months, in our spare time and on weekends, building a consumer based mobile application called OutCast. The mobile application is tailored towards those who like spending time outdoors, whether that be …

Nov 23, 2013

go Training golang

This is a guest post from Tad Vizbaras from Etasoft in South Florida. There are a number of editors and IDEs for Go development. LiteIde, Vim, Emacs and GEdit just to name a few. Each developer has their own favorite editor for each language they …

Nov 21, 2013

go Training golang

Have you ever found yourself in this situation. You have a case statement inside of a for loop and you would like to break from both the case and for statements in a single call? var err error timeout := time.After(30 * time.Second) sigChan := …

Nov 5, 2013

go Training golang

Linux is unique to Windows in many ways, and writing programs in Linux is no exception. The use of standard out, standard err and null devices is not only a good idea but it’s the law. If your programs are going to be logging information, it is …

Nov 3, 2013

go Training golang

I am working on a project that requires pulling and processing different XML feeds from the web and storing the data into MongoDB as JSON. Since new feeds come up everyday, changing the Go program to process and publish new feeds is out of the …

Oct 26, 2013

go Training golang

Introduction If you are using 3rd party packages, (packages that you don't own or control), you will want a way to create a reproducible build every time you build your projects. If you use 3rd party packages directly and the package authors change …

Oct 17, 2013

go Training golang

I was testing new functionality on a program that is already running in production when suddenly the code behaved very badly. What I saw shocked me and then it became obvious why it happened. I also have a race condition just waiting to be a problem. …

Oct 10, 2013

go Training golang

In Go values that are returned from functions are passed by value. Go gives you some nice flexibility when it comes to returning values from a function. Here is a simple example of returning two values from a function: package main import (   …

Oct 2, 2013

go Training golang

Introduction In my post about building and running programs in Iron.Io, I needed to switched over to my Ubuntu VM to build linux versions of my test programs locally. I love the ability to have Ubuntu available to me for building and testing my code. …

Oct 1, 2013

go Training golang

Nathan Youngman, with the help of others, has produced this document outlining months of research and discovery. I would appreciate everyone to honestly read it before continuing with my post. http://nathany.com/go-packages/ Mitchell …

Sep 26, 2013

go Training golang

I always find it interesting when I realize that something I have been practicing or dealing with for a long time has a name. This time it happens to be race conditions. This is something you can’t avoid thinking about as soon as you have more …

Sep 26, 2013

go Training golang

This article was written for and published by Gopher Academy I was looking at a code sample that showed a recursive function in Go and the writer was very quick to state how Go does not optimize for recursion, even if tail calls are explicit. I had …

Sep 23, 2013

go Training golang

Slices are used everywhere in my code. If I am working with data from MongoDB, it is stored in a slice. If I need to keep track of a collection of problems after running an operation, it is stored in a slice. If you don’t understand how slices …

Sep 14, 2013

go Training golang

After working in Go for some time now, I learned how to use an unbuffered channel to build a pool of goroutines. I like this implementation better than what is implemented in this post. That being said, this post still has value in what it describes. …

Sep 10, 2013

go Training golang

I am working on building code to load polygons for the different Marine Forecast areas in the United States. These polygons need to be stored in MongoDB and there is a special way that needs to be done. It would not have been a big deal if it …

Sep 7, 2013

go Training golang

Introduction Iron.io has a product called IronWorker which provides a task oriented Linux container that you can run your programs inside. If you are not sure what I mean, think of this as having a temporary Linux virtual machine instantly available …

Sep 4, 2013

go Training golang

In my Outcast data server I have several data retrieval jobs that run using different go routines. Each routine wakes up on a set interval. The most complex job is the downloading of radar images. What makes this complex is that there are 155 radar …

Aug 31, 2013

go Training golang

Earlier in the month I wrote a post about using C Dynamic Libraries in Go Programs. The article built a dynamic library in C and created a Go program that used it. The program worked but only if the dynamic library was in the same folder as the …

Aug 28, 2013

go Training golang

For those of you who are like me, trying to learn the Mac and Linux operating systems, Golang programming and deployment constructs all at the same time, I feel your pain. I have been building a Go application for a couple of months on my Mac and it …

Aug 26, 2013

go Training golang

If you are coming to Go after using a programming language like C# or Java, the first thing you will discover is that there are no traditional collection types like List and Dictionary. That really threw me off for months. I found a package called …

Aug 20, 2013

go Training golang

My son and I were having fun last weekend building a console based game in Go. I was recreating a game from my youth, back when I was programming on a Kaypro II. I loved this computer. I would write games in BASIC on it all day and night. Did I …

Aug 15, 2013

go Training golang

Since I started programming in Go the concept and use of slices has been confusing. This is something completely new to me. They look like an array, and feel like an array, but they are much more than an array. I am constantly reading how slices are …

Aug 8, 2013

go Training golang

I ran into a problem today. I was building code to consume NOAA’s tide station XML document and quickly realized I was in trouble. Here is a small piece of that XML document: <timezone>LST/LDT</timezone> <item> …

Aug 5, 2013

go Training golang

Back in June, Gustavo Niemeyer posted the following question on his Labix.org blog: Assume uf is an unsigned integer with 64 bits that holds the IEEE-754 representation for a binary floating point number of that size. How can you tell if uf …

Jul 29, 2013

go Training golang

This article was written for and published by Safari Books Online Back in May, I finally decided that it was time to move away from the Microsoft stack to Linux. The cost of developing, licensing, and purchasing cloud computing on the Microsoft stack …

Jul 27, 2013

go Training golang

This article was written for and published by Safari Books Online If you read my article titled Analyze Data With MongoDB and Go, then you will understand the context of this debate with the idea of open source. That article talks about an …

Jul 27, 2013

go Training golang

In the documentation provided by the Go language team you will find great information on pointers and memory allocation. Here is a link to that documentation: http://golang.org/doc/faq#Pointers We need to start with the understanding that all …

Jul 24, 2013

go Training golang

This article was written for and published by Safari Books Online My company is building a mobile application called Outcast. The idea behind Outcast is to give people who love the outdoors the ability to get ahead of the weather. By analyzing real …

Jul 20, 2013

go Training golang

On June 22nd through the 26th, Portland Oregon is hosting OSCON (Open Source Convention). The event is run by O’Reilly. After looking at the speakers list it appears it is going to be a great convention. There are three Gophers who will be …

Jul 12, 2013

go Training golang

When I was coding in C/C++ it was imperative to understand type. If you didn’t, you would get into a lot of trouble with both the compiler and running your code. Regardless of the language, type touches every aspect of programming syntax. A …

Jul 10, 2013

go Training golang

Someone asked a question on the forum today on how to gain the benefits of inheritance without embedding. It is really important for everyone to think in terms of Go and not the languages they are leaving behind. I can’t tell you much code I …

Jul 6, 2013

go Training golang

Multi-threaded applications are very complicated, especially when your code is not organized and consistent with how resources are accessed, managed and maintained. If you want to minimize bugs you need philosophies and rules to live by. Here are …

Jul 5, 2013

go Training golang

Since I started writing code in Go it has been a mystery to me how best to organize my code and use the package keyword. The package keyword is similar to using a namespace in C#, however the convention is to tie the package name to the directory …

Jun 24, 2013

go Training golang

I have been writing Windows services in C/C++ and then in C# since 1999. Now that I am writing server based software in Go for the Linux OS I am completely lost. What is even more frustrating, is that for the first time the OS I am developing on (Mac …

Jun 17, 2013

go Training golang

I was really surprised how easy it was to read an XML document using the encoding/xml package that comes with the standard library. The package works by defining structs that map the XML document. If you need more flexibility then use Gustavo …

Jun 13, 2013

go Training golang

I wanted to send an email from my TraceLog package when a critical exception occurred. Fortunately Go’s standard library has a package called smpt which can be found inside the net package. When you look at the documentation you are left …

Jun 11, 2013

go Training golang

I have been struggling with using the Time package that comes in the Go standard library. My struggles have come from two pieces of functionality. First, trying to capture the number of milliseconds between two different time periods. Second, …

Jun 8, 2013

go Training golang

I am building my TraceLog package and it is really important that the package logs any internal exceptions and prevents panics from shutting down the application. The TraceLog package must never be responsible for shutting down an application. I also …

Jun 5, 2013

go Training golang

As you know if you read my blog, I have been building a set of new utility packages so I can start developing an application server I need for a new project. I am brand new to Go and the Mac OS. Needless to say it has been one hell of an education …

Jun 2, 2013

go Training golang

Check out my new installtion document: https://www.ardanlabs.com/blog/2016/05/installing-go-and-your-workspace.html I removed the sections about gocode and GDB. These are not necessary any longer. I also added links for more editors. Windows This is …

May 31, 2013

go Training golang

After working in Go for some time now, I learned how to use an unbuffered channel to build a pool of goroutines. I like this implementation better than what is implemented in this post. That being said, this post still has value in what it describes. …

May 31, 2013

go Training golang

For the past 20 years I have been writing server based and application software on the Microsoft stack. First in C/C++ leveraging the Win32 API and then in C# when .Net first was released. Over the past few months I have realized that trying to build …