Avatar (Fabio Alessandro Locati|Fale)'s blog

CORS headers with gRPC-Gateway

July 28, 2021

A few years ago, I wrote a blog post on managing CORS headers with Negroni. Lately, I’ve created a new API server that needed to be accessible from the browser, but this time I used a different technology, more precisely gRPC-Gateway. Few months after I wrote that blog post, I stopped writing new REST services by hand. I did not rewrite all the services that used the old paradigm just because they needed a fix or a new feature, but for all new services, I moved to gRPC with gRPC-Gateway.

Read More

Sensible datetime scale for Gonum Plot

June 28, 2021

Few months ago I posted a library for sensible int scale for Gonum Plot. There is a similar package I’ve developed to handle timescales. The integer one, being based on a recursive function, works with any number scale. Differently, this one will only work well with a timescale between 2 days and a couple of years. Extending it is not hard since it’s enough to add additional case statements in the switch, but I’ve not found use-cases for different timeframes so far.

Read More

Sensible integer scale for Gonum Plot

January 20, 2021

Over the years, I found myself multiple times using Gonum Plot. I do find it as a very good and easy to use plotting tool for Go. The problem I found myself, over and over, dealing with is the tickers scale. If you know before-hand the values that can be expected to be created by the application, it is very straightforward, but the majority of times, this is not the case.

Read More

Google Cloud Snapshot Cleaner v0.2.0

September 22, 2019

Last week, in a previous article, I’ve introduced you to gcsc (Google Cloud Snapshot Cleaner). I’ve just released the version 0.2.0 of it, and it has a lot of clean-ups done, both in the code and the user experience. There are also some new features, but the one I’m more satisfied with, is the introduction of the http subcommand, to expose an HTTP server. The webserver will listen to any URI and Methods, and the request will trigger the snapshot clean-up.

Read More

Google Cloud Snapshot Cleaner v0.1.0

September 16, 2019

I’ve just tagged the first version (0.1.0) of gcsc (Google Cloud Snapshot Cleaner). The idea behind this small software is to create a more flexible way to keep the Google Cloud Disks Snapshots tidy. Google Cloud does provide a very nice way to automatically snapshot your disks, leveraging the resource policies. This is very nice, since it allows you to be sure that the Google Cloud always and reliably snapshots your disks.

Read More

Calling a SOAP service in Go

December 3, 2018

Today the IT world is very focused on high performance, high throughput interfaces. In this situation, it is common to find REST and gRPC API, given their performances compared to the other solutions. Sometimes, though, we still encounter old API written with older techniques or new API that for some reasons have been developed with outdated technologies. One of those cases that I’ve encountered a few times over the last few months is SOAP.

Read More

CORS with Go and Negroni

November 18, 2018

There are some pieces that you need to put in every microservice you write. Those are for instance logging, error handling, authentication. Over the last year, I found myself writing over and over CORS headers. This requirement brought me to think that I should have used a Negroni middleware since we are already using Negroni for other middlewares. I started looking online for an already written one, and I found a bunch, but I was not happy with what I found, so I decided to write my own.

Read More

A lightweight approach to Go vanity import paths

September 23, 2018

Golang forces its users to use the repository URL of the dependency in the import statement. For instance, if we want to import the “test” package that is hosted at github.com/fale/test, we will need to use github.com/fale/test. In one hand this is very nice since it allows anyone reading the code to immediately understand where the code is hosted and therefore finding it very quickly. Also, this URL-based import path guarantees that no two different packages can have the same import path, preventing this kind of confusion for both programmers and the compiler itself.

Read More

A small HTTP debug server in Go

August 31, 2018

Lately, I found myself to work on an application that was communicating via SOAP with a server. My goal was to understand how this application worked with the SOAP server to emulate its behavior. Even if I had access to the source code of the application, I thought it would have been easier, faster and more fun to do the work without actually reading the code. It’s important to note that actually, the application is fairly small and self-contained.

Read More

An HTTP server to serve GCS files

April 12, 2018

As many other clouds, Google Cloud Platform provides an Object Storage service, Google Cloud Storage. As many other Object Storage service, Google Cloud Storage provides an HTTP server to deliver your files quickly. When I started to use Google Cloud Storage and its HTTP server I have not been entirely pleased by how it works and therefore I wanted to re-implement the HTTP server so that I can manage it completely.

Read More
Older