Best of GolangOctober 2024

  1. 1
    Video
    Avatar of communityCommunity Picks·2y

    I made a multiplayer game from scratch because no one is hiring junior devs.

    A junior developer, frustrated with the job market, built a multiplayer browser game to enhance their resume. The game features turn-based tactics on a 2D hexagonal grid with limited player visibility and a shrinking map. The client-side is developed using TypeScript and HTML5 canvas, while the server-side is implemented in Golang using websockets. The project includes complex features like responsive UI, pathfinding, animations, and real-time multiplayer logic. Despite some challenges, including iOS websocket issues, the game is functional and available to play.

  2. 2
    Video
    Avatar of awegoAwesome 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. 3
    Article
    Avatar of awegoAwesome 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. 4
    Video
    Avatar of dreamsofcodeDreams of Code·2y

    SQLc is the perfect tool for those who don't like ORMs

    SQLc is an efficient tool for developers who prefer writing raw SQL queries over using ORMs. It allows for type-safe SQL query generation, fitting neatly within the repository design pattern. SQLc supports multiple programming languages (TypeScript, Kotlin, Python, and Go) and SQL engines (Postgres, MySQL, SQLite). It eliminates boilerplate code, making database interactions more manageable and reusable across codebases. By using SQLc, developers can maintain full control over queries while ensuring type safety and reducing development time.

  5. 5
    Video
    Avatar of awesome-codingAwesome·2y

    A Web Dev Tries Game Development

    A seasoned web developer, bored with web development and wary of being replaced by AI, decides to explore game development. Despite considering various game engines like Unity, Godot, and Unreal, the developer opts to build a game from scratch using Go. Key concepts covered include initializing a project, setting up the main game loop, defining update and draw methods, creating animated characters, handling player inputs, and implementing basic physics and collisions. The journey concludes with adding a boss fight to the game, highlighting both the challenges and excitement of game development.

  6. 6
    Article
    Avatar of golangnutsGo Developers·2y

    My journey to Golang

    The author has recently embarked on learning the Go Programming Language using the book 'Learning Go' by Jon Bodner and is thoroughly enjoying the experience.

  7. 7
    Article
    Avatar of awegoAwesome 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.

  8. 8
    Video
    Avatar of codeheimcodeHeim·2y

    #59 Golang - Create Professional PDFs: A Complete Guide with Maroto

    Learn to generate professional PDFs using Golang with the Maroto package. This guide walks you through the entire process, from installing Maroto to creating a complete PDF document with sections like headers, invoice details, item lists, and footers. Each part is broken down into manageable steps with clear explanations for building and styling your PDF efficiently.

  9. 9
    Article
    Avatar of threedotslabsThree Dots Labs·2y

    Distributed Transactions in Go: Read Before You Try

    The post discusses the complexities of using distributed transactions in microservices with Go. It warns against using distributed transactions due to their complications and instead suggests alternatives like embracing eventual consistency and using the outbox pattern. The post also provides a detailed implementation approach for using event-driven architecture with Redis and Watermill in Go, including handling events asynchronously and ensuring data consistency. It emphasizes the importance of correct service boundaries and provides guidance on testing and monitoring event-driven systems.

  10. 10
    Article
    Avatar of communityCommunity Picks·2y

    jesseduffield/lazydocker: The lazier way to manage everything docker

    Lazydocker is a Go-based terminal UI designed to simplify the management of Docker and Docker-Compose. It provides a single-terminal view for all necessary Docker commands and allows for easy customization. Features include viewing container logs, metrics, and states, as well as restarting, removing, or rebuilding containers. Installation can be done through various package managers or by building from source. Contributions from the community are encouraged, and the tool supports mouse events for easier navigation.

  11. 11
    Article
    Avatar of communityCommunity Picks·2y

    fastschema/fastschema: A Go web framework and Headless CMS

    FastSchema is a Go web framework and headless CMS designed to simplify building and managing dynamic web applications. It automates database generation and provides CRUD APIs, features a built-in admin control panel, supports MySQL, PostgreSQL, and SQLite, and includes role-based access control. It also supports real-time updates, a plugin system, OpenAPI documentation, and more. FastSchema can be set up quickly using Docker, and it is currently in beta with opportunities for community contributions.

  12. 12
    Video
    Avatar of techworldwithnanaTechWorld with Nana·2y

    Full Golang Tutorial - Learn Go by Building a TodoList App

    Learn the essentials of Go (Golang) by building a to-do list application. This crash course covers the motivation behind Go's development, setting up the development environment, and understanding basic syntax and core concepts such as data types, variables, loops, and functions. Additionally, it demonstrates how Go is particularly suited for multi-threaded, concurrent applications, making it ideal for cloud-based deployments.

  13. 13
    Article
    Avatar of awegoAwesome 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.

  14. 14
    Article
    Avatar of communityCommunity Picks·2y

    My first CLI with Go

    The author shares their journey of creating a CLI tool to practice Go, inspired by a tutorial. They initially planned to create a Golang server for a mono repo architecture, but shifted to developing a CLI tool due to challenges with hot reload. The CLI uses the `os` module for file and folder creation and leverages templates for file structure. The author discusses encountered issues like module path configuration, database integration complexity, and hot reloading, inviting contributions to the project.

  15. 15
    Article
    Avatar of evolvedevevolvedev·2y

    Building a Google Drive Downloader in Golang (Part 2)

    Part 2 of the tutorial explores core features of a Google Drive downloader in Go, focusing on handling multiple concurrent downloads, updating progress in real-time, and managing cancellations. To fully benefit, refer to Part 1 for foundational setup including Google OAuth integration.

  16. 16
    Article
    Avatar of awegoAwesome Go·2y

    Golang developers should try Odin

    Odin is a new programming language that offers a compelling alternative to Golang. It addresses several issues like memory leaks and slow compilation associated with Golang. Odin is designed to include features you wish Golang had and emphasizes array programming and low-level operations. It is suitable for game and backend development due to its stable core library and ongoing improvement of its compiler and toolchain. The language prioritizes manual memory management and provides a structured way of handling errors without a garbage collector. Odin's syntax and usability make it an attractive option for experienced Golang developers.

  17. 17
    Article
    Avatar of towardsdevTowards Dev·2y

    Building an API with Go, PostgreSQL, Google Cloud and CockroachDB

    The post outlines the process of building and deploying an API using Go, PostgreSQL, Google Cloud Run, and CockroachDB. It provides detailed steps for setting up a local PostgreSQL database, creating an API server with Go, managing middleware and routes, handling error structures, caching, and deploying on Google Cloud Run. Additionally, it includes instructions for integrating with CockroachDB and using Google Secret Manager for managing sensitive data like certificates.

  18. 18
    Video
    Avatar of codeheimcodeHeim·2y

    #58 Golang - Asynchronous Messaging with RabbitMQ

    Learn how to integrate RabbitMQ with Go for building scalable distributed systems. The post covers the basic architecture of RabbitMQ, how to set up a producer to send messages, and a consumer to receive messages using the AMQP protocol. The tutorial uses the Gin framework to set up a web server and demonstrates sending and receiving messages through HTTP requests. Additionally, it discusses handling errors and system interrupts.

  19. 19
    Video
    Avatar of awesome-codingAwesome·2y

    The Secret to a Happy Dev Life

    Enjoying your job is key to avoiding burnout, especially in repetitive fields like web development. To keep coding enjoyable, focus on solving new, interesting problems outside of your regular tasks. This approach not only rekindles your passion for coding but also improves your skills by pushing you out of your comfort zone. The post discusses creating a programming language and implementing a PR parser in Kotlin, highlighting the importance of continuous learning and creativity in a developer's career.

  20. 20
    Article
    Avatar of planetgolangPlanet Golang·2y

    Using a separate Go module for your `tools.go` · Jamie Tanna

    Using a separate Go module for managing tool dependencies like linting or code generation helps reduce clutter in the top-level go.mod file. By migrating to a multi-module project, dependencies used only for building or testing are isolated, making the dependency graph cleaner and more manageable.

  21. 21
    Video
    Avatar of codeheimcodeHeim·2y

    #57 Golang - Understanding Build Tags in Go: A Seamless Way to Control Builds

    Build tags in Golang provide a powerful way to manage environment-specific configurations and platform-specific code. By using build tags, developers can control which code is included in the build for different environments like development, staging, and production. Build tags also facilitate handling different operating systems and processor architectures, improving the development workflow and making it more efficient.

  22. 22
    Article
    Avatar of lobstersLobsters·2y

    Glad I did it in Go

    The author reflects on the success of using Go for writing the book 'Writing An Interpreter In Go' that has stood the test of time since its release in 2016. The Go code from the book still compiles and runs without issues in the latest Go version, proving Go's stability and simplicity. The post highlights Go's universal formatting style, built-in tools, and ease of understanding, making it an excellent choice for writing interpreters and compilers.

  23. 23
    Article
    Avatar of evolvedevevolvedev·2y

    The Ultimate Guide for Deploying Go Applications to Production

    Learn to deploy Go applications and services in the cloud. The guide covers building binaries, deploying on VPS, using Docker, and more.

  24. 24
    Article
    Avatar of cerbosCerbos·2y

    How to implement authorization using Cerbos in Go

    Learn how to implement robust authorization in a Go web application using Cerbos and Echo. This guide walks you through setting up a secure RESTful API to enforce access control policies, detailing necessary components like in-memory databases, API routes, and handlers. By the end, you'll be able to create an efficient role-based access control (RBAC) system, ensuring users have appropriate permissions based on their roles.

  25. 25
    Article
    Avatar of itnextITNEXT·2y

    Fuzz Testing Go HTTP Services

    Fuzz testing, or fuzzing, is an automated software testing technique used to find bugs, crashes, and security vulnerabilities by inputting large amounts of random data into a program. It is now integrated into Go’s standard library as of Go 1.18, making it part of the regular testing package. Fuzz testing can reveal bugs that traditional testing might miss and is a recommended practice for improving the robustness of code, including HTTP services. The post provides step-by-step instructions for creating fuzz tests in Go, including an example for fuzzing HTTP handlers using Go's `httptest` package.