Go SSR Wins over JavaScript

In this day and age, server side rendering proves it is stable and more effective than the JavaScript bloat we are growing used to. Any simple page, with perhaps at most 3 KB of actual text content will download over 2 MB of JavaScript in order to simply function. Besides that fact, SPA and API situations, where you have a decoupled frontend from the backend, still do not justify the fact of using JavaScript, or even worse, any of its frameworks....

January 31, 2021 · 5 min · Josep Jesus Bigorra Algaba

Go Style Guide

This serves as a supplement to Effective Go, based on years of experience and inspiration/ideas from conference talks. Add context to errors Don’t: file, err := os.Open("foo.txt") if err != nil { return err } Using the approach above can lead to unclear error messages because of missing context. Do: file, err := os.Open("foo.txt") if err != nil { return fmt.Errorf("open foo.txt failed: %w", err) } Wrapping errors with a custom message provides context as it gets propagated up the stack....

January 26, 2021 · 11 min · Josep Jesus Bigorra Algaba

Go File Descriptors

Ever heard of dangling pointers? Have you ever left your database connections without closing them properly? One must pay special attention to this specially when dealing with lower level languages like Go, C, and C++. Resource leaks really are a do or die in many applications, something very often and very easily overlooked. I personally have had applications catastrophically crash due to this. Read this to understand useful patterns and practices avoiding these problems in Go…...

November 13, 2020 · 5 min · Josep Jesus Bigorra Algaba

Zen of Go

Something that I’ve been thinking about a lot recently, when reflecting on the body of my own work, is a common subtitle, how should I write good code? Given nobody actively seeks to write bad code, this leads to the question; how do you know when you’ve written good Go code? If there’s a continuum between good and bad, how to do we know what the good parts are? What are its properties, its attributes, its hallmarks, its patterns, and its idioms?...

October 4, 2020 · 4 min · Josep Jesus Bigorra Algaba
Go logo

Clean Go - Part I

Why Write Clean Code? This document is a reference for the Go community that aims to help developers write cleaner code. Whether you’re working on a personal project or as part of a larger team, writing clean code is an important skill to have. Establishing good paradigms and consistent, accessible standards for writing clean code can help prevent developers from wasting many meaningless hours on trying to understand their own (or others') work....

October 2, 2020 · 24 min · Josep Jesus Bigorra Algaba

Go has make and new functions, what gives ?

This is a post about Go’s built in make and new functions. As Rob Pike noted at Gophercon on 2014, Go has many ways of initialising variables. Among them is the ability to take the address of a struct literal which leads to several ways to do the same thing. s := &SomeStruct{} v := SomeStruct{} s := &v // identical s := new(SomeStruct) // also identical It is fair that people point out this redundancy in the language and this sometimes leads them to search for other inconsistencies, most notably the redundancy between make and new....

September 18, 2020 · 4 min · Josep Jesus Bigorra Algaba