Golang Digest
2.49K subscribers
164 photos
1 video
190 links
Everything about Go: news, articles, tools, language changes, etc.

#go #golang #concurrency #postgres #database #db
Download Telegram
Testing concurrent code with testing/synctest πŸ€“

One of Go’s signature features is built-in support for concurrency. Goroutines and channels are simple and effective primitives for writing concurrent programs.However, testing concurrent programs can be difficult and error prone.

In Go 1.24, the go team are introducing a new, experimental testing/synctest package to support testing concurrent code. This post will explain the motivation behind this experiment, demonstrate how to use the synctest package, and discuss its potential future.

Link to the article


#go #go@digest_golang #article #article@digest_golang #goblog #goblog@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
❀3πŸ‘2πŸ”₯2
How to manage tool dependencies in Go 1.24+ πŸ“†

Historically, managing dependencies β€” especially in a team setting β€” has been tricky. The previous solutions have been to use a tools.go file or the go run pattern, but while these approaches work, they’ve always felt like workarounds with some downsides.
With Go 1.24, there’s finally a better way.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
1πŸ”₯4❀2πŸ‘2
Faster Go maps with Swiss Tables πŸ“†

Go 1.24 includes a completely new implementation of the built-in map type, based on the Swiss Table design. In this blog post we’ll look at how Swiss Tables improve upon traditional hash tables, and at some of the unique challenges in bringing the Swiss Table design to Go’s maps.

Link to the article

#go #go@digest_golang #article #article@digest_golang #goblog #goblog@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
1πŸ‘3πŸ”₯3
Tips to debug hanging Go programs πŸ“†

If your Go app becomes unresponsive, these tips can help you identify the issue by forcing a stack trace or using Delve to attach to the process (or core dump) and revive the program.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯3❀2πŸ‘2
Different ways of working with SQL Databases in Go πŸ‘΄

In this article, we'll explore and compare most popularly used Go packages for relational databases with hands-on examples, pros and cons. We will also briefly touch on the topic of database migrations and how to manage them in Go.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
1πŸ”₯6πŸ‘4πŸ¦„1
Cursor for large Go projects πŸ“†

This guide shares my workflow for Cursor and how to use it for large projects. For context, here at Stream, we power chat, activity feeds, and video for over a billion end users. ~800k lines of Go code.


Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
2πŸ”₯3πŸ‘2❀1
From unique to cleanups and weak: new low-level tools for efficiency ❀️

An overview of two new features in Go 1.24’s garbage collector: runtime.AddCleanup and weak.Pointer. Cleanups work similarly to finalizers but avoid some of their issues by not reviving the objects they are linked to. Weak pointers allow referencing objects without stopping them from being garbage collected.

Link to the article

#go #go@digest_golang #article #article@digest_golang #goblog #goblog@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
1πŸ”₯4❀3πŸ‘2
How We Slashed API Response Times by 50% with Go Compiler Optimizations πŸ’ͺ

I still remember the day our CTO walked into our team meeting with that look on his face. Our API response times were tanking, and customers were NOT happy. What I didn’t realize then was that we’d end up solving the problem by digging into Go compiler optimizations, not by throwing more hardware at it or rewriting everything from scratch.


Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘5πŸ”₯4πŸ†’4❀2
Go Structs and Interfaces Made Simple πŸ”¨

In this blog post, we'll demystify Go's structs and interfaces, exploring how they differ from classes in traditional OOP languages and why Go's approach leads to more maintainable and flexible code. Whether you're new to Go or have been using it without fully grasping these concepts, this guide aims to make these foundational elements click.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
1πŸ‘5πŸ”₯32
Timeout Middleware in Go: Simple in Theory, Complex in Practice πŸ”¨

I’ve been happily using standard timeout middleware in my Go services, until one day I needed to add a new file upload endpoint that required a much longer timeout than the others. What seemed like a one-minute job turned into an unexpected challenge.
Let’s explore how to build a robust, chainable timeout middleware that solves these challenges.


Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯6πŸ‘4✍3
golangci-lint v2 ❀️

The second version of the most popular linter for go has been released: golangci-lint!
In this article, the author explains what has changed and what has been improved.

Link to the release note

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
1πŸ‘7❀3πŸ”₯2🀩1
Golang on the PlayStation 2 πŸ’ͺ

Let’s get straight into it: I want to run code into consoles (more on why this in a future post). Normally this is done in low(er) level languages, but nowadays we have better and easier to work with languages such as Go. So I was wondering.. why not?


Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
1πŸ‘6πŸ”₯3❀2🀩1
Faster interpreters in Go: Catching up with C++ πŸ’ͺ

PlanetScale is a popular cloud-based MySQL hosting service that uses Vitess, a MySQL scaler built with Go. This article tells the story of creating a virtual machine in Go to work with the SQL ASTs generated by their SQL parserβ€”and how it performs as fast or even faster than MySQL’s C++ implementation.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯4πŸ‘2❀1
How I Scaled a Golang App to Handle 1.5M Requests Per Minute πŸ“†

Great article where the author gives a set of rules that allow him to write high-load applications in Go.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
1πŸ”₯6πŸ‘3❀1
A Guide to Optimizing for High Performance in Go πŸ”¨

A growing collection of technical articles designed to help Go developers build faster, more efficient applications. It starts by covering common patterns like object pooling, struct field alignment, and worker pools, with a high-performance networking guide coming soon.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
1πŸ‘5πŸ”₯4
Faster shuffling in Go with batching πŸ”¨

Random integer generation is a fundamental operation in programming, often used in tasks like shuffling arrays. Go’s standard library provides convenient tools like rand.Shuffle for such purposes. You may be able to beat the standard library by a generous margin. Let us see why.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯4πŸ‘3❀2
More predictable benchmarking with testing.B.Loop ❀️

Go developers who have written benchmarks using the testing package might have encountered some of its various pitfalls. Go 1.24 introduces a new way to write benchmarks that’s just as easy to use, but at the same time far more robust: testing.B.Loop.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
1πŸ”₯4πŸ‘1
Using Signals With Go πŸ“†

Signals are asynchronous messages delivered to processes to inform them of events such as interrupts, crashes, or termination, or to initiate specific actions. Most programming languages provide mechanisms to catch and handle signals β€” for example, to enable a program to shut down gracefully β€” and Go supports this as well.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯5πŸ‘4❀2
Where and why should you use iterators in Go? ❀️

In this article, I decided to dive in and figure out where iterators could actually be useful in practice. I read a bunch of articles, checked out developers’ feedback, asked around on Reddit β€” and in the end, I put together a list of cases where iterators can genuinely come in handy. I’ve already used a few of them in my own projects, and I’ve got to admit β€” it turned out to be pretty convenient.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
1❀5πŸ‘2πŸ”₯1
Golang sync.Pool is not a silver bullet πŸ“†

When it comes to performance optimization in Go, sync.Pool often appears as a tempting solution. It promises to reduce memory allocations and garbage collection pressure by reusing objects. But is it always the right choice? Let's dive deep into this fascinating topic.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯8πŸ‘2
Cheating the Reaper in Go πŸ“†

The article shows how to build a high-performance arena allocator in pure Go using unsafe, bypassing the garbage collector for manual memory control.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
1πŸ”₯6πŸ‘2