Golang Digest
2.58K subscribers
163 photos
1 video
189 links
Everything about Go: news, articles, tools, language changes, etc.

#go #golang #concurrency #postgres #database #db
Download Telegram
Make an MMO with Godot 4 + Golang

A thirteen video YouTube series on building a multiplayer online game using the popular Godot game engine (no relation to Go) and with Go handling the backend.

https://www.youtube.com/playlist?list=PLA1tuaTAYPbHAU2ISi_aMjSyZr-Ay7UTJ#goandgodot

#go #go@digest_golang #video #video@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
Exploring the new "go tool" support in Go 1.24 🤓

Go 1.24 introduces new support for "Tools", which allows easy consumption of tools (which are written in Go) as a dependency for a project. This could be anything from golangci-lint to protoc-gen-go.
In this post the author cover usage and limitations.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
The proposal has appeared suggesting to add the ? operator to handle errors. The author suggests instead of the usual notation:

r, err := SomeFunction()
if err != nil {
return fmt.Errorf("%v", err)
}


add the ability to do this:

r := SomeFunction() ? {
return fmt.Errorf("%v", err)
}


The err variable inside the braces will automatically contain the error.
The discussion was heated. Some people like this idea, while others say that it breaks the philosophy of Go and makes the language more complicated.
Go Slices and Subslices: Understanding Shared Memory and Avoiding `append()` Pitfalls 🔨

Go is often praised for its simplicity and efficiency — "Go just gets the job done," as they say. For those of us coming from languages like C, C++, or Java, Go’s straightforward syntax and ease of use is refreshing. However, even in Go, certain quirks can trip up developers, especially when it comes to slices and subslices. Let's uncover these nuances to better understand how to avoid common pitfalls with append() and shared memory in slices.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
Real-Time Batching in Go 🔨

Batching is a well-known optimization technique. You see it everywhere: batch inserts in databases, MGET/MSET in Redis, various bulk APIs. The benefits are clear — it’s faster, cheaper, and less rate-limited. These benefits usually come at the cost of slightly more complex code and some boilerplate.

But how do we cleanly batch something we can’t see yet? Something that’s arriving in real time.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Go slice gotchas 🔨

Just like any other dynamically growable container structure, Go slices come with a few gotchas. We don’t always remember all the rules we need to be aware of. So this is an attempt to list some of the most common mistakes I’ve made at least once.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
A round up of Go 1.24's performance improvements ❤️

We all want our code to run as fast as possible. But have you ever stopped to wonder how many microseconds it takes to do a map lookup in Go? Or how much memory gets allocated when you create a small object? The Go team thinks about this stuff constantly, and in Go 1.24, they’ve made some pretty exciting improvements that make everything about 2-3% faster.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
Go's map does not shrink 👾

Go's map does not shrink (in terms of allocated memory). Sorry, but it just doesn't...

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
Go 1.24 is released! ❤️

Go 1.24 comes with many improvements over Go 1.23. Here are some of the notable changes; for the full list, refer to the release notes.

The main changes in this version are:
* The go tool mechanism for tracking tool dependencies
* The use of Swiss Tables to speed up map operations
* Experimental testing/synctest package for testing concurrent code
* Improved WebAssembly support
* and much more, for details see the link: https://go.dev/blog/go1.24

#go #go@digest_golang #goblog #goblog@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
How Protobuf Works—The Art of Data Encoding 💪

Protobuf (Protocol Buffers) is a way to serialize data into a compact binary format. This makes it smaller in size and faster to transmit over the network, though at the cost of being less human-readable.

Let’s run a simple benchmark comparing google.golang.org/protobuf and encoding/json in Go. While this may not be a perfectly fair comparison, it will reflect common choices.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
Extensible Wasm Applications with Go 📆

Go 1.24 enhances its WebAssembly (Wasm) capabilities with the addition of the go:wasmexport directive and the ability to build a reactor for WebAssembly System Interface (WASI). These features enable Go developers to export Go functions to Wasm, facilitating better integration with Wasm hosts and expanding the possibilities for Go-based Wasm applications.

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
Map internals in Go 1.24 🔨

Maps in Go 1.24 have undergone a complete rewrite, significantly improving their performance. The new implementation draws inspiration from Google's high-performance hash map design known as Swiss Tables.
Let's figure out how they work now.

Link to the article

#go #go@digest_golang #article #article@digest_golang
Please open Telegram to view this post
VIEW IN TELEGRAM
A database written fully in Go 🔨

A Reddit user shared their project — a minimalist persistent relational database written in Go. The main focus was on storage management and transactions. Indexes are implemented using a B+ Tree, and parallel data reading is supported.

Awesome project!

Link to the repo

#go #go@digest_golang #project #project@digest_golang
Please open Telegram to view this post
VIEW IN 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
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
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
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
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