November 4, 2021

Back to Google - after de-googling my phone

I’m an avid Android user for 10+ years. Like many other tech-oriented people, I’m not a fan of Google and its policies (a few reasons listed later), and I’m constantly trying to use alternatives where possible. I’ve used Custom ROMs for years (with Google apps), but recently used my phone for 4+ months without any Google service. The previous week I reinstalled Google’s factory image - here’s why and what next steps I plan to make to keep my privacy. Read more

July 27, 2021

Glice v2 - Adding support for go.mod

Glice has been the first open-source project I published on my GitHub account. It’s a dependency checker for Go that used to go through all .go files, parse the imports and fetch the licenses for third-party dependencies. Long overdue I’ve added support for projects using Go Modules and did a major refactor simultaneously. Read more

April 14, 2021

HTTP logging in Go

Having good logging is crucial for running and debugging applications in production. It reduces your issue to resolution time by providing details about every action, request, and response. Designing a good logging system isn’t a trivial task, and requires an eye for detail. Here’s how I do it in Go! Read more

February 17, 2021

Removing null values from maps or JSON with Go

Recently I was given a task of removing all keys that have null values from an arbirtrary json. We do data processing of Excel/csv files and have default config generated for them server-side. Users provide custom configuration (column types, names, headers, sorting …) and these two get merged. Problem was - if key existed and had null value it would override the key that had a value. Obviously there may be other ways to do this, but this is a very generic solution that can be used in most cases. Read more

August 2, 2020

A robust RabbitMQ client in Go

A few months ago I started working on a project that heavily relies on RabbitMQ as a message broker. We have two clients communicating with Go, one via AMQP (RabbitMQ) and the other through HTTP. As our dependency on RabbitMQ is big, I had to write a robust client that does graceful shutdowns, panic recoveries, is multithreaded, logs everything nicely, and more. Read more

May 23, 2020

Pushing data upstream in Context

Go’s context is a hefty tool that was added as an official package back in 1.7. The context package provides contextual information that a goroutine may need such as how long it should run and how and when it should end. It can also pass informational key-value pairs for use down the call chain. But what if we need to pass information up in the call chain? Pointers come to the rescue. Read more

February 2, 2020

Updating Goroutines post-creation

One of the greatest things about Go is how it deals with concurrency. It is far simpler compared to other languages. It uses so-called goroutines - a lightweight thread managed by the Go runtime. While they are mostly used for asynchronous, fire-and-forget stuff (most common usage being HTTP multiplexers), I recently needed to have them updated post creation. The obvious first choice in Go would be to use channels, but trying to build the solution with them caused me some issues, which made me opt for a far simpler one - maps. Read more

January 20, 2020

Writing RESTful APIs in Go, 3 years later

I’ve started working with Go in early 2017, and since then most of my work has been writing RESTful APIs with it. With time I gained experience. and I constantly change the way I write APIs in Go. After a year of working with Go, I’ve released Gorsk - a Golang RESTful starter kit, and an update to it 6 months later. I get many emails and questions on how to use it properly, which means that something like Gorsk is highly needed. Over time I’d like to keep it up-to-date with my latest views on how to write REST APIs in Go, and this blog post serves as a first step in the next iteration. Read more

January 1, 2020

A Year in Review - 2019

I never felt confident writing my ‘year in review’ until this year. I felt that I haven’t much to share, and even if I had I thought it wasn’t interesting. After reading a few similar posts from other bloggers, and having quite an interesting year, I thought that this year would be good to start with. Read more

October 10, 2019

dt - Go's missing datetime package

Go’s standard library contains a single date package - time. The type provided by it, Time, contains date, time and location information. More often than not we don’t need location info, or we need to represent date/time only. dt provides exactly that, a time-zone-independent representation of time that follows the rules of the proleptic Gregorian calendar with exactly 24-hour days, 60-minute hours, and 60-second minutes. Read more

2018 © Emir Ribic - Some rights reserved; please attribute properly and link back. Code snippets are MIT Licensed

Powered by Hugo & Kiss.