Welcome to Memory Notes!

This cozy corner of the internet is my personal treasure chest of knowledge, packed with handy info, code snippets, and quick notes I’ve gathered along my journey. It’s all about building a go-to stash of insights for those “aha!” moments. If you find a gem in here that brightens your day or solves a puzzle, that’s a win in my book!

How to Develop a Custom Plugin for protoc

This guide will walk you through the steps to create a plugin for protoc, the protocol buffer compiler. A plugin allows you to generate custom code based on your .proto files. Step 1: Set Up Your Project Create a new directory for your plugin and initialize a new Go module: mkdir myprotocplugin cd myprotocplugin go mod init myprotocplugin Step 2: Define the Main Function Your plugin will read a CodeGeneratorRequest from standard input and write a CodeGeneratorResponse to standard output....

July 8, 2024 · 3 min · Kirill Sysoev

Optimizing Go Applications: Mastering Request Deduplication Techniques

In the evolving landscape of software development, particularly within distributed systems and services that demand idempotency, the challenge of managing duplicate requests has emerged as a important concern. This article delves into the concept of request deduplication in the Go programming language, a technique pivotal for enhancing the efficiency and reliability of applications. Request deduplication, at its core, aims to identify and mitigate the processing of identical requests multiple times, thereby preventing the common pitfalls associated with such redundancies....

June 30, 2024 · 5 min · Kirill Sysoev

Go Custom Profilers

In the ever-evolving landscape of software development, the need for precise and tailored performance analysis has never been more critical. Go, with its robust performance and concurrency model, offers developers a powerful platform for building efficient applications. However, even with Go’s built-in profiling tools, there are scenarios where a more customized approach is necessary to truly understand and optimize your application’s performance. This article dives into the world of custom profilers in Go, showcasing how to extend beyond the standard profiling tools to capture and analyze the specific metrics that matter most to your application....

June 23, 2024 · 2 min · Kirill Sysoev

CPU Profiling in Go with pprof

Performance is a critical aspect of any application. Understanding how your program utilizes CPU resources can provide valuable insights into potential bottlenecks and areas for optimization. One of the most effective ways to visualize CPU usage is through a flame chart, a graphical representation of your program’s call stack over time. In the realm of Go, a statically typed, compiled language renowned for its simplicity and efficiency, we have robust built-in tools for performance analysis....

June 16, 2024 · 6 min · Kirill Sysoev

Understanding and Utilizing Error Wrapping in Go

In Go, error handling is a crucial aspect of creating robust and reliable software. One common scenario is when you need to pass an error up the call stack, but also want to add additional context. This is where error wrapping comes into play. Wrapping Errors The fmt package in Go provides a function called Errorf that allows you to create formatted error messages. It also supports a special placeholder %w that can be used to wrap errors with additional context....

June 10, 2024 · 2 min · Kirill Sysoev