Best of Awesome GoAugust 2024

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

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

  3. 3
    Article
    Avatar of awegoAwesome Go·2y

    Escape JavaScript hell and write everything in Go

    The post describes an annual remake of a personal website using a new web stack focusing on HTMX and Go to avoid JavaScript/TypeScript complications. The author discusses the advantages of this approach for smaller, non-interactive HTML displays and explains the benefits of using tools like PocketBase, templ, TailwindCSS, and AlpineJS. The post emphasizes server-side rendering and the ease of making UIs without client-side state management.

  4. 4
    Article
    Avatar of awegoAwesome Go·2y

    Build Go Serverless REST APIs and Deploy to AWS using the SAM framework (Amazon Linux 2 Runtime)

    Learn how to build and deploy Go serverless REST APIs using AWS SAM framework. The post highlights the deprecation of Go1.x for AWS Lambda, emphasizing the need for up-to-date tutorials. It emphasizes key software development principles such as Infrastructure as Code, good naming conventions, robust testing strategies, availability & scalability, deployment pipelines, observability, and security. A comprehensive example is provided illustrating these principles in a serverless architecture.

  5. 5
    Article
    Avatar of awegoAwesome Go·2y

    What's the best Static Analysis tool for Golang?

    When writing Golang code, ensuring that all return errors are checked can be challenging. Traditional tools like golint and go vet fall short in catching all errors. However, tools like errcheck and StaticCheck offer specific checks but require manual management. The Go Analysis API enables combining multiple tools into a single driver, and golangci-lint effectively runs various static analyzers together, providing a comprehensive static analysis solution for Golang. It integrates well with IDEs and CI pipelines, improving code reliability by catching non-obvious bugs.