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

#go #golang #concurrency #postgres #database #db
Download Telegram
βœ… Go code coverage to SVG treemap

An interesting way to visualize large projects by way of go test -coverprofile’s results.

https://github.com/nikolaydubina/go-cover-treemap

#go #tool
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3πŸ”₯1
βœ… Dependency injection in Go with Google Wire

The author shows by example how you can implement dependency injection between components using the wire library from google.
The library allows you to implement compile-time dependency injection without using reflection, which can speed up the time and speed of your application.

Link to the article

#go #article #tool
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3
βœ… State Machine Pattern in Golang. Async and Singleton with Policies implementation

State Machine is a very useful pattern that can actually be used in practice quite often. The author explains and shows how to implement the State Machine pattern in golang, which can be executed both synchronously and asynchronously

Link to the article

#go #article
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘2πŸ”₯1
βœ… Solving Concurrency Problems with Redis and Golang

Redis is currently the most popular key-value database. When using Redis in Go applications, you may encounter issues with multithreading. The author of the article demonstrates these potential problems and explains how to solve them using Redis's built-in features.

Link to the article

#go #article
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯2πŸ‘1
βœ… Mastering Concurrent Processing: A Step-by-Step Guide to Building a Scalable Worker Pool in Go

As we know, Go excels at processing large volumes of data quickly and efficiently. In today's article, Sourav Choudhary walks us through creating a scalable worker pool in Go, providing clear, step-by-step instructions and advice to avoid common pitfalls that could impact performance.

Link to the article

#go #article
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘2πŸ”₯1
βœ… Why Are Golang Heaps So Complicated

Heap is an important data structure that helps understand how the language and many applications work. The author compares how heaps function in Golang and Python, and then discusses a few libraries in Go that implement heaps, highlighting the pros and cons of each.

Link to the article

#go #datastructure #article
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯2πŸ‘1
βœ… Alternatives to Makefiles written in Go

The Makefile is an essential component found in almost every large Go project. However, make has its downsides - it's not very flexible, and the commands can often be complex and hard to read.
The author of the article discusses two tools that can replace make: Taskfile, which allows you to describe instructions in the familiar YAML format, and Mage, an alternative tool that lets you write Makefile-like instructions in Go, offering greater flexibility.

Link to the article

#go #tool #article
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3πŸ”₯2
βœ… Abusing Go's infrastructure

Upon discovering that repositories with no Go code were included in Go's checksum database, the author decided to investigate whether arbitrary data could be uploaded to Go's servers and to determine if this posed a significant security concern.

Link to the article

#go #article
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯4
βœ… buf - the best way of working with Protocol Buffers

Go applications often work with the gRPC protocol, which is faster than standard REST. When working with gRPC, you might find an excellent open-source tool called Buf very useful. Buf helps manage your proto files by generating a unified file from those located in different directories (e.g., you can separate your project’s proto files from vendor proto files). Additionally, Buf includes linters that check your proto files and prevent errors, along with many other features that simplify working with proto files.

Link to the official website

#go #tool
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘4πŸ”₯2
βœ… Go State Machine Patterns

State Machine pattern is a complex and truly necessary pattern, the implementation of which can reduce the complexity and simplify the readability of the code. The article explains when this pattern can and should be implemented, what it can replace, and how it simplifies the development of complex projects.

Link to the article

#go #article #pattern
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯4πŸ‘1
βœ… Go 1.23 Will Support Iterators!

A proposal has been accepted and approved, according to which Go will support iterators starting from version 1.23. The inclusion of iterators in the language provides the ability to iterate over streaming data, which can be critically important at times. Here's an interesting discussion on Reddit with many examples demonstrating that iterators and the capabilities they bring make up for the increased complexity of the language.

#go #proposal
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3πŸ”₯2
βœ… Profiling Go Applications in the Right Way with Examples

When developing large-scale products, it's crucial to understand how much resources our application consumes. Go offers a set of built-in profiling tools that can assist in optimizing resource usage and detecting memory leaks. For an excellent article on this topic with plenty of examples, follow the link.

#go #article
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘5πŸ”₯1
βœ… Distributed File Storage In Go – Full Course

A video from freeCodeCamp that covers the complete development cycle of a decentralized distributed file storage system with content-based addressing in Go. This system can handle very large volumes of data. The video includes designing, developing, and working with network protocols.

https://www.youtube.com/watch?v=IoY6bE--A54

#go #video
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘8
βœ… Profile-guided optimisation (PGO) on Grab services

Earlier, we shared Cloudflare's experience with optimizing their Go applications using PGO (Profile-Guided Optimization), which has been available in Go since version 1.20.
Next up, we have an article from Grab detailing their experience compiling applications with PGO flags. Spoiler alert: they managed to reduce CPU usage by 10-30% for some applications!

Link to the article

#go #article
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘5πŸ”₯1
βœ… Sentinel errors and errors.Is() slow your code down by 500%

The article discusses the performance impacts of various error-handling strategies in Go. The author benchmarks different methods, finding that using sentinel errors combined with errors.Is() can slow down code execution by over 500%. The analysis includes comparisons of performance for different scenarios and offers insights into best practices for error handling in Go to optimize performance.

Link to the article

#go #article
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘6
βœ… xstrings - functions for working with strings that you're used to

The library implements a wide range of familiar string manipulation functions that are built into other languages but not available in Go. For example, it includes ShuffleSource(), similar to str_shuffle in PHP, and SwapCase(), similar to str.swapcase in Python or String#swapcase in Ruby.

https://github.com/huandu/xstrings

#go #tool
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘7πŸ”₯3
βœ… Understanding Go and Databases at Scale: Connection Pooling

The article explains how to manage database connections in Go, focusing on connection pooling to optimize performance and resource use. It details the benefits of reusing connections instead of creating new ones, outlines implementation steps in Go, and offers best practices for efficient database interaction at scale.

Link to the article

#go #article
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘9❀2
βœ… Go Error Propagation and API Contracts

This article, written by a Google engineer, discusses why you shouldn’t simply proxy errors in Go without additional processing, the importance of wrapping errors, and how doing otherwise can lead to problems with mixing the domains of your application.

Link to the article

#go #article
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘4πŸ”₯2
βœ… goyave - the enterprise REST API framework

Goyave an opinionated all-in-one Golang web framework focused on REST APIs, with emphasis on code reliability, maintainability and developer experience.

https://github.com/go-goyave/goyave

#go #tool
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯4πŸ‘2
βœ… Live website updates with Go, SSE, and htmx

MiΕ‚osz SmΓ³Ε‚ka, the author of "Go with Domains," has written an intriguing article on setting up Server-Sent Events (SSE) using Go, Google Pub/Sub, and htmx. The result is a fascinating project that allows clients to receive updates without using JavaScript. For example, when one site user posts a comment, it automatically appears for all other users without needing to refresh the page. Cool!

Link to the article

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