Originally published on https://dgarcia.dev/playing-with-go-and-generics/

Yes, it’s happening! The proposal to add generics to Golang was accepted. It means that in some versions in the future, we’ll be able to code generic solutions without having to use complex workarounds with the empty interface{}. But, how it works?

TLDR: Now there’s a type parameter described with square brackets to define generics types for structs, functions, etc. For instance:

func Print[T any](s []T) {
for _, v := range s {

The identifier any means that the type T can be any type

With the previous notation we can use…

Originally published on https://dgarcia.dev/building-a-personal-activity-tracker/

Disclaimer: This project/post is inspired on Building an activity tracker with Go, Grafana, and InfluxDB by lucapette, so there’re many common points and strategies.

If you’re reading this in 2021 you’re living the Coronavirus Pandemic Era and you’re most likely working from home. Well, I’m working from home too with my fiance and my daughter (and two cats). I’m a software engineer who works in a big retail company and this kind of job is very intense. To archive a good work/life balance, I try to do a great focused job on my working hours, but…

fonte: Google Images

Se você não estava preso em uma cabana no meio da floresta totalmente isolado do mundo, com certeza já deve ter ouvido falar sobre o Kubernetes, caso ainda não tenha ouvido falar, o Kubernetes (também conhecido como k8s) segundo o site oficial.

É um sistema open source para deployments automatizados, scaling e gerenciamento de aplicações conteinerizadas

Se você ainda não teve a oportunidades de conhecer esse projeto fantástico, pause a leitura desse artigo e procure saber mais sobre, você pode começar por aqui.

Agora que você já sabe o que é o k8s, já sabe o impacto que ele vem…

As I said before, I'm working on a great project called Teresa written in Golang that uses gRPC. To facilitate monitoring and health checks, we decided to expose a health check endpoint with HTTP standard protocol instead of gRPC, but how can we expose those services on the same port?

There is a great project called cmux that can help us like a charm. According to cmux documentation: cmux is a generic Go library to multiplex connections based on their payload. In other words, you create a common net.Listener

I’m having a lot of fun working on Teresa project (Teresa is a simple PaaS on top of Kubernetes). Our main use case is Magazine Luiza where we deploy hundreds of applications to cloud with AWS as a cloud provider of our Kubernetes cluster.

Recently we chose to change from go-swagger to gRPC. Consequently, the project quality took a leap forward. But after that, an annoying behavior came across. When you expose a Load Balancer service in Kubernetes, it creates a load balancer on the cloud provider and by default, the AWS ELB performs a health check in its backend…

Diego Garcia

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store