Best of GolangDecember 2024

  1. 1
    Article
    Avatar of devtoDEV·1y

    I Tried Every Hot Programming Language

    The author compares their experiences working with GoLang, Zig, and Rust through practical projects. They found GoLang easy to learn and reliable, Zig explicit and fast but lacking memory safety, and Rust challenging due to its strict memory rules but ultimately rewarding. The comparison highlights the strengths and weaknesses of each language and concludes that the best choice depends on specific use cases and team preferences.

  2. 2
    Article
    Avatar of awegoAwesome Go·1y

    Organizing Your Go Code: Tips for Beginners

    Organizing Go code can be challenging for beginners. Start with a clear project name and initialize your directory as a Go module using `go mod init`. Focus on simplicity by only creating necessary files like `main.go`, `godan_test.go`, and `godan.go`. Follow principles such as KISS (Keep It Simple, Stupid) and YAGNI (You Aren't Gonna Need It) to guide development and postpone creating extra directories and files until genuinely needed, ensuring readability and simplicity in your codebase.

  3. 3
    Article
    Avatar of communityCommunity Picks·1y

    Golang 1.24 is looking seriously awesome

    Golang 1.24 introduces several notable features and improvements: a 2-3% performance boost, a new weak pointer implementation, support for post-quantum cryptography in `crypto/tls`, the `omitzero` tag for better zero value handling in `encoding/json`, and a `tool` directive in `go.mod`. The release also enhances the testing package with context support and introduces an experimental `testing/synctest` package for concurrent code testing. These updates promise better memory usage, enhanced security, and improved developer experience.

  4. 4
    Article
    Avatar of antonzAnton Zhiyanov·1y

    Gist of Go: Pipelines

    Learn to use goroutines and channels to build concurrent pipelines in Go. Understand the importance of handling goroutine cancellations properly to avoid leaks. Discover how to merge multiple channels and create efficient pipelines using select statements and cancel channels.

  5. 5
    Article
    Avatar of communityCommunity Picks·1y

    Build a URL Shortener with Go, Redis, and HTMX

    Learn to build a URL Shortener using Go, Redis, and HTMX. The tutorial covers setting up the Go environment, installing Redis, building a basic HTTP server with Go’s standard library, and implementing a simple URL shortening algorithm. It also includes instructions for integrating Redis as a fast in-memory data store, and creating a reactive UI with HTMX and TailwindCSS. The final steps involve setting up URL redirection and deploying the application.

  6. 6
    Article
    Avatar of communityCommunity Picks·1y

    go-task/task: A task runner / simpler Make alternative written in Go

    Task is a user-friendly task runner and build tool designed to be simpler and easier to use compared to GNU Make. It is written in Go and provides streamlined functionality for various automation needs.

  7. 7
    Article
    Avatar of awegoAwesome Go·1y

    Are Pointers in Go Faster Than Values?

    New Go developers might assume that pointers are always faster than values because copying is slow. However, it's essential to focus on writing clear and maintainable code first. While local non-pointer variables on the stack are generally faster than pointers, using pointers should be reserved for cases where a shared reference is needed. Performance issues related to stack and heap allocation should be addressed through benchmarking and tangible optimization efforts.

  8. 8
    Article
    Avatar of communityCommunity Picks·1y

    cloudlena/s3manager: A Web GUI for your S3 buckets

    s3manager is a Web GUI written in Go for managing S3 buckets from any provider. It allows users to list buckets, create new ones, upload and download objects, and delete objects. The application is configurable via environment variables and can be run locally, with Docker, or deployed to a Kubernetes cluster. It supports SSL, various signature types, IAM roles, and server-side encryption.

  9. 9
    Article
    Avatar of communityCommunity Picks·1y

    How Redis Solved Our Challenges with Dynamic Task Scheduling and Concurrent Execution? [Developer's Guide]

    The post discusses migrating a task scheduling system from a simple Go service using SQLite to a more complex SaaS platform. The new challenges of dynamic scheduling and concurrent execution were solved using Redis's sorted set for task prioritization and Postgres for handling distributed writes. Evaluations of various scheduling libraries indicated rq_scheduler in Python as the most suitable. The result was an efficient architecture capable of scalable and reliable task scheduling and execution.

  10. 10
    Video
    Avatar of codeheimcodeHeim·1y

    #69 Golang - Mastering Bloom Filters

    Bloom filters are probabilistic data structures used to check if an element is part of a set quickly and with minimal memory usage. They guarantee no false negatives but allow false positives. Ideal for caching and pre-filtering large datasets, bloom filters can reduce unnecessary database queries in web applications. The post details how to install and implement a bloom filter in a Golang-based web app for checking user access to features, along with parameter estimation for optimizing performance.

  11. 11
    Article
    Avatar of golangGo·1y

    Go Protobuf: The new Opaque API

    Go Protobuf has introduced a new Opaque API to improve performance and memory efficiency by decoupling the generated code API from the in-memory representation. This change hides struct fields and replaces direct field access with getter and setter methods. The Opaque API supports lazy decoding and reduces pointer-related bugs. Migration to the Opaque API is recommended for new development, with a hybrid option available for existing codebases.

  12. 12
    Video
    Avatar of codeheimcodeHeim·1y

    #68 Golang - Master Background Tasks with Asynq: Complete Guide

    Learn how to master the Asynq package in Golang to handle background tasks. The guide covers installing Asynq, setting up clients and servers, creating various tasks like email delivery, report generation, and image processing. It also explains how to utilize Redis for managing queues, configuring servers for task priorities and concurrency, and monitoring tasks using Asynq's web interface.

  13. 13
    Video
    Avatar of codeheimcodeHeim·1y

    #66 Golang - Concurrency - Worker Pool Management with Tunny

    Learn how to use the Tunny library in Golang to manage worker pools for efficient resource utilization in concurrent systems. Tunny allows you to control the number of goroutines running simultaneously, helping optimize CPU usage and prevent excessive memory consumption. The post includes a step-by-step guide to installing Tunny, creating a worker pool, and simulating tasks like sending emails while maintaining an efficient concurrency model.

  14. 14
    Article
    Avatar of bitfieldconsultingBitfield Consulting·1y

    What are the best Go books in 2025? — Bitfield Consulting

    Choosing the right Go books is crucial for learning and mastering the language. Recommended books cover various levels from beginners to advanced topics like concurrency, cryptography, TDD, and generics. Titles include 'For the Love of Go' for starters, 'The Power of Go: Tools' for intermediate learners, and 'Know Go' for understanding generics. Each book addresses different aspects and skills necessary for Go programming, ensuring a comprehensive learning experience.

  15. 15
    Article
    Avatar of lobstersLobsters·1y

    Why Golang slices still surprise me

    Golang slices have dual behavior, acting as either dynamically sized arrays or fat pointers, which can cause confusion and bugs. Dynamic arrays own their data, while fat pointers do not, making some operations like appending invalid depending on the context. The capacity field in slices introduces surprising behaviors like reslicing beyond the length and modifying capacity, contradictory to Go's minimalist philosophy.

  16. 16
    Article
    Avatar of lobstersLobsters·1y

    Building a distributed log using S3 (under 150 lines of Go)

    The post describes how to implement a durable, distributed, and highly available log using AWS S3 in less than 150 lines of Go. Key highlights include the structure of the log interface, the implementation of the Append and Read operations, handling concurrent writes with S3 conditional writes, and failover/crash recovery mechanisms. The open-source project includes code and tests, with several open issues for further improvements.

  17. 17
    Video
    Avatar of communityCommunity Picks·1y

    Python (FastAPI) vs Go (Golang) Performance Benchmark

    The post compares the performance of FastAPI, a Python web framework, with Go's standard library. The tests measure latency, throughput, CPU and memory usage, error rates, and CPU throttling. Deployed on Kubernetes in AWS, the tests evaluate the frameworks in a basic scenario and a more complex one involving database interactions and caching. FastAPI lags significantly behind Go in performance, reaching a limit quickly, while Go maintains higher throughput and lower latencies for extended periods.

  18. 18
    Article
    Avatar of antonzAnton Zhiyanov·1y

    Gist of Go: Time

    The chapter explains how to manage time in concurrent Go programs through various techniques. It covers throttling, backpressure, operation timeouts, timers, and tickers. Each technique is explained with code examples and their use cases, helping readers to implement efficient time management in their concurrent applications.

  19. 19
    Video
    Avatar of lowlevellearningLow Level Learning·1y

    Why Is Everyone Coding in Go?

    Go has become a popular language for coding streams on Twitch because it is easy to learn, fun to use, and provides straightforward, understandable code that viewers can follow along with easily.

  20. 20
    Article
    Avatar of awegoAwesome Go·1y

    How to Set Up Authorization in a Bookstore Management System with Go, HTMX, and Permit.io

    Authorization is vital for application security, determining accessible resources and actions based on user roles. This tutorial guides you through building a bookstore app with authorization using Golang, HTMX, and Permit.io. The app includes role-based access control for admin and standard users, dynamic data loading, and secure user role management through Permit.io. It covers project setup, database configuration with PostgreSQL, HTTP handlers, and middleware for authorization checks.

  21. 21
    Article
    Avatar of communityCommunity Picks·1y

    What to expect from Go 1.24 - Part 1

    Go 1.24, scheduled for release in February 2025, introduces major features including full support for Generic Type Aliases and a new tool directive in go.mod. Generic Type Aliases allow for more versatile and type-safe code definitions. The tool directive helps manage executable dependencies directly in go.mod, eliminating the need for workarounds like tools.go files. These additions enhance code readability, maintenance, and the development workflow.