Originally published on https://dgarcia.dev/changelogger/

I started a project called changelogger. This project is a very simplified version of Towncrier but written in Go.

I can already hear you say: Why?. Well, Golang isn’t the main goal here, but the fact that I can distribute this tool as a binary without care about the developer environment. There’s no problem with Python (to tell the truth, Python has been paying my bills for ten years) but, I wouldn’t like to force a Golang/JavaScript/Java/[put here your favorite lang] dev to setup a python environment only to use a simple tool.

I used towncrier…


Originally published on https://dgarcia.dev/programming-kubernetes-running-pods/

This is the first post of a series I want to publish about interact with the Kubernetes programmatic instead of using kubectl for example. In this first post, we’ll create an API that runs an individual pod and returns the exit code with the stdout of the execution, something like that:

$ curl -i -d \
'{"image": "python:3.7.0", "command": "python",\
"args": ["-c", "print(\"Hello World\")"]}'\
http://api-endpoint/

HTTP/1.1 200 OK
Content-Length: 41
Content-Type: application/json; charset=utf-8

{"exit_code": 0, "output": "Hello World\n"}

Explaining the request payload:

  • image: the container image.
  • command: main command the container will execute.
  • args: the command…


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 {
fmt.Print(v)
}
}

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