Gopher it: Issue #2
Your bi-weekly spot to learn about everything happening in the GO community!
Welcome to the second issue of Gopherit!, your bi-weekly spot to learn about everything happening in the GO community, from blog posts to YouTube tutorials and community highlights.
As avid GO enthusiasts, we wanted to create a curated list of resources so we don't have to spend a ton of time searching the internet to keep up on the latest and greatest.
Blog posts 📚
Introducing pgroll: zero-downtime, reversible, schema migrations for Postgres
Carlos Pérez-Aradros Herce introduces `pgroll`, a newly launched open-source command-line tool providing a safer, easier approach for schema migrations in PostgreSQL. `pgroll` offers zero downtime and reversible schema migrations by keeping both old and new schema versions available for the duration of the process. The tool aims to fit easily into typical workflow plans, alleviating some headaches associated with schema migrations.
A Deep Dive Into Reflection in Go
In his article, Timilehin Omolana dives deep into understanding the concept of reflection in the Go programming language, built for dynamic code analysis and manipulation. He uncovers the power of the reflect package, providing key insights into its two central types - reflect.Type and reflect.Value and demonstrate reflection's usage in Go programs with practical examples. He also lays down guidelines on reflection's best practices, cautioning it can reduce application performance and readability if not used wisely.
Defer Functions in Golang: Common Mistakes and Best Practices
Reza Khademi provides a comprehensive guide on using defer functions in Golang. Defer functions allow for statements to be executed just after a surrounding function ends, even in the event of an error. He highlights common mistakes when using defer, like neglecting potential errors returned by defer, and offers solutions such as anonymous functions to fix these issues.
Although Ilija Eftimov's article on using golden files for testing in the Go programming language is dated, it remains highly relevant today. It offers a step-by-step guide on implementing and managing these golden files, making testing easier when hardcoding the output of a unit is cumbersome. Despite its age, Eftimov's piece continues to provide useful insights and important cautionary advice regarding version control, storage, parsing, and updating of these files.
Youtube Videos 📹
Implement role-based access control (RBAC) in Go
In the video tutorial by TECH SCHOOL, the concept and implementation of role-based access control (RBAC) in API access are taught. Techniques such as defining roles for a system in a role.go file, modifying the DB schema to manage user roles, and modifying an interface method to include role parameters are demonstrated.
Todo App using: Go Postgres HTMx TailwindCSS | This is the way
In a comprehensive tutorial, NerdCademy explains how to build a server-side rendered to-do application using HTMX, Go, Postgres, and Tailwind. From initializing a Postgres database, setting up a Docker file, and managing a persistent data volume, to setting data connections, handling errors, and testing the application, NerdCademy provides a detailed step-by-step guide on the process.
Handling errors LIKE a 10x ENGINEER in Golang - Golang Service Pattern
Samvcodes's video explains error handling in the Go language's service pattern by wrapping generic errors and creating custom error types. This aids in precise error messaging and simplified debugging across varying servers.
Building Distributed Applications with Event-Driven Architecture
In his discussion, Eric Johnson, Principal Developer Advocate for Serverless at AWS, discusses building distributed applications with event-driven architecture, highlighting the use of AWS cloud-native services. He explores enterprise integration patterns, the role of decoupling for scalability, and the importance of item potency in distributed systems.
Package of the week 📦
Gowebly is a CLI tool that simplifies the construction of web applications incorporating Go, HTMX, Hyperscript, and utility-first CSS frameworks. Features include live-reloading for CSS, smart CLI, cross-platform compatibility, and a helper library for quicker web app development.
Community Highlight ✨
The proposed improvements to the "encoding/json" package in Go, v2, will address missing functionalities, API deficiencies, performance setbacks, and behavioral issues. The new version will separate the "json" package into two parts, "jsontext" and "json", focusing on enhancing correctness, performance, and flexibility. Changes include enhancements to Encoder and Decoder types, the introduction of primary data types like Kind, Value, and Token, and new methods for managing JSON tokens and values, and more complex configurations.
Thanks for reading Gopherit! Subscribe for free to receive new posts and support our work. If you are interested in working on GO full-time, check out our opening for a Staff Backend Engineer (Go) at Stream.