Best of Awesome Go — 2024
- 1
- 2
Awesome Go·2y
Complete Backend Engineering Course in Go
This course offers a comprehensive guide to backend engineering in Go, covering the creation of a RESTful API from scratch to deployment. It spans from basic concepts like creating a low-level TCP server to advanced topics like authentication, authorization, caching, logging, CI/CD, and deployment to Google Cloud. The course emphasizes understanding core principles, design patterns, and best practices for API development, including the repository pattern, clean architecture, optimistic concurrency control, and more. A free, initial module is available, along with a GitHub repository for further exploration.
- 3
Awesome Go·2y
How I Stopped Worrying and Learned to Love Go Interfaces
Go interfaces provide a way to define behavior without specifying the method of implementation. They improve code flexibility and cleanliness by allowing different types to satisfy the same interface as long as they implement the required methods. Understanding and using interfaces are essential for scalable and maintainable code. Example implementations include Animal types making different sounds and Shapes calculating area and perimeter.
- 4
Awesome Go·2y
Announcing River UI
River UI provides a user-friendly interface for managing SQL-backed job queues, featuring a backend Go API and a frontend built with React and TypeScript. It allows users to monitor job states, interact by cancelling, retrying, or deleting jobs, and offers features like pausing queues during issues. River UI is available as a Docker image and a pre-built static binary, with future enhancements planned.
- 5
Awesome Go·2y
Avoiding Beginner Mistakes Hampering You to Scale Backend⚡️
The post outlines techniques for dramatically scaling backend performance from 50K to 1M requests on minimal resources. Key strategies include building an observability pipeline, performing stress tests, connection pooling, enforcing resource constraints, disabling implicit transactions, adding indexes, handling transaction locks, and increasing file descriptor limits. The backend, developed in Golang with a monolithic architecture using GIN and GORM, underwent significant optimizations to achieve improved efficiency and scalability.
- 6
Awesome Go·2y
A JavaScript developer tries Go for the first time
A JavaScript developer shares their first impressions of the Go programming language, highlighting its error handling, defer statement, explicit type conversion, switch statement, pointers, simple type system, and consistent approach to coding.
- 7
Awesome Go·2y
Microservices Authentication and Authorization Using API Gateway
Learn about the challenges of authentication and authorization in a microservices architecture, the benefits of using an API Gateway for access management, and how JSON Web Tokens (JWTs) are used for authentication in microservices.
- 8
Awesome Go·2y
How I sent 500 million HTTP requests to 2.5 million hosts
An individual leveraged Go's simplicity and concurrency to send 500 million HTTP/1.1 requests to 2.5 million hosts for an ethical hacking use case. By utilizing Kubernetes for horizontal scaling and optimizing both code and libraries, they achieved this massive scale efficiently. Key optimizations included pre-resolving DNS, hand-crafting HTTP requests, and using the fasthttp library.
- 9
Awesome 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.
- 10
Awesome Go·2y
Learning Golang - Resources, book recommendation, and philosophy
This post provides resources and book recommendations for learning Golang, including the main Go website, the Go blog, and the Effective Go documentation. It also suggests using the Learn Go with Tests website for learning through writing tests. Several books are recommended, covering topics such as web development, concurrency, and event-driven architecture. The importance of practicing coding and using the standard library is emphasized.
- 11
Awesome Go·2y
Go is Not Java
This post discusses the misconception of posting 'Patterns in Go' articles by Java programmers and highlights that many of these patterns are considered anti-patterns. It explores the definition of Object Oriented programming and suggests that Go is more 'Object Oriented' than C++ or Java. The post also mentions the language that is most familiar with Object Oriented principles and criticizes the promotion of misinformation in articles about patterns in Go.
- 12
Awesome Go·1y
Mastering Modern APIs with Go: From Basics to Best Practices🌐💻🚀
APIs are crucial for modern software development, acting as intermediaries that allow different systems to communicate. This guide explores how to build and consume APIs using Go, highlighting key concepts such as endpoints, HTTP methods, and data formats. It also provides best practices for error handling, security, and rate limiting and includes practical steps for setting up, writing, and testing API code in Go.
- 13
Awesome Go·2y
Golang Defer: From Basic To Traps
The defer statement in Go delays the execution of a function until the surrounding function finishes, useful for cleanup actions like closing resources. There are three types of defer in Go: heap-allocated, stack-allocated, and open-coded, each with different performance characteristics. Multiple defers are executed in a last-in-first-out order, and recover can regain control after a panic within a deferred function. Deferred function arguments are evaluated immediately, which can lead to complexities if not handled properly. Proper error handling with defer includes capturing defer return values.
- 14
Awesome Go·2y
Go and Postgres Listen/Notify or: How I Learned to Stop Worrying and Love PubSub
This post explains how to implement PubSub functionality using PostgreSQL's Listen/Notify feature in Golang applications. Unlike traditional PubSub systems that rely on message brokers like Redis, PostgreSQL's Listen/Notify allows for an efficient, single-system solution. The author discusses the use of pgx for connection management, introduces a custom Notifier package, and provides code examples illustrating how to set up a listener, notifier, and subscription system efficiently. Key points include handling notifications, managing subscriptions, and dealing with blocking calls.
- 15
Awesome Go·2y
The value of API-First design on side-projects
API-First design prioritizes the development of APIs before implementing other parts of a software system. It places the API at the center of the development process, facilitating the creation of a well-designed and consistent API that serves as the foundation for the entire application. By using tools like OpenAPI Specification, developers can generate backend and frontend code, ensuring better synchronization and saving time. This method leads to improved development speed, reduced errors, and better API documentation, making it a highly beneficial approach for side projects.
- 16
Awesome Go·2y
Hexagonal Architecture/Ports And Adapters: Clarifying Key Concepts Using Go
This post explains Hexagonal Architecture, also known as Ports and Adapters. It discusses its origins, the concept of Ports and Adapters, and provides a concrete example using Go. The post also highlights the benefits of using Ports and Adapters, such as flexibility, testability, and reduced dependencies.
- 17
Awesome Go·2y
7 Common Interface Mistakes in Go
Learn about common mistakes developers make when working with interfaces in Go and how to avoid them. The post covers key principles like interface segregation, behavior-driven interfaces, and the importance of small, precise interfaces. It also emphasizes avoiding interface pollution by creating interfaces only when needed, and highlights best practices for interface design to ensure simplicity, readability, and organic code growth.
- 18
Awesome 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.
- 19
Awesome Go·2y
Build a chat room with custom bots powered by OpenAI/Gemini
Build a chat room that combines chat platforms like Discord and Slack with AI bots powered by OpenAI and Google Gemini. This guide walks you through running the application locally, deploying to Encore's free dev cloud, and integrating with Slack/Discord. Key components include an Open Source Go-based application, multi-platform support, and multi-model compatibility with OpenAI and Gemini. Setup involves installing Encore CLI, configuring API keys, local development with a single command, and seamless cloud deployment.
- 20
Awesome Go·2y
Building BLE Applications with BleuIO and Go
This tutorial provides step-by-step guidance on building Bluetooth Low Energy (BLE) applications using the BleuIO USB dongle and the Go programming language. It covers setting up the development environment, installing required packages, and writing a Go program to interact with the BLE dongle. Key features of BleuIO, including its easy-to-use AT Commands and cross-platform support, are also highlighted.
- 21
Awesome Go·2y
The differences between "Type Alias" and "New Types" in Go
Learn the differences between type aliases and new type declarations in Go. A type alias serves as a nickname for an existing type, ensuring full compatibility without the need for type conversions. In contrast, new type declarations create entirely new types that require explicit conversions and can add domain-specific methods for enhanced type safety. Make informed decisions between the two based on your code's needs for refactoring or creating domain-specific logic.
- 22
Awesome Go·2y
EchoVault: Embeddable Redis Alternative in Go
EchoVault is an open-source, embeddable in-memory datastore designed for Go applications, offering a RESP-compatible interface over TCP. It aims to replace traditional in-memory data stores like Redis, eliminating the overhead of separate management and deployment. Key features include TLS support, RAFT-based replication, various data structures, and access control. EchoVault supports both standalone and clustered deployments, making it suitable for use cases like in-memory caching, service discovery, session management, real-time analytics, and more.
- 23
- 24
Awesome Go·2y
Writing raw SQL easier with pgx and sqlc in Go
Combine pgx, a PostgreSQL driver and toolkit for Golang, with sqlc, a tool that generates type-safe Go code from SQL queries, to streamline database interactions. While ORMs can be limiting for complex queries, pgx and sqlc offer more control and type safety. Using sqlc for CRUD operations and simple queries, and pgx for more complex queries, provides a balanced approach. The post outlines how to set up and use these tools in a Go project.
- 25