Golang notes – Telegram
This blogpost explores the process of integrating authentication into an API using the Encore.go framework. It demonstrates how to create an API endpoint that requires authentication, leveraging Encore's built-in features to handle token validation and user data retrieval. The post also covers testing strategies for authenticated APIs, showcasing Encore's support for mocking authentication data during test scenarios.

https://dev.to/eminetto/creating-an-api-with-authentication-using-encorego-3lak
This article introduces two new features in Go 1.24: runtime.AddCleanup and weak.Pointer. These tools enhance efficiency by allowing developers to manage resources more effectively. The runtime.AddCleanup function schedules a function to run when an object is no longer reachable, while weak.Pointer allows safe references to objects without preventing garbage collection. Together, they provide powerful alternatives to traditional finalizers and can be used to build custom resource management solutions.

https://go.dev/blog/cleanups-and-weak
This blogpost chronicles the author's journey in creating their first Zig program, "zigping," a terminal-based utility similar to gping. Coming from a background in Go, the author highlights the challenges of manual memory management in Zig and explores its build system, error handling, and multithreading capabilities. The project serves as a learning ground for understanding Zig's unique features and overcoming the hurdles of transitioning from a garbage-collected language like Go.

https://pliutau.com/my-first-zig-program-zigping/
This article explores why Go uses pointers instead of references, a choice that often puzzles developers transitioning from languages like Java or Python. It explains that pointers provide explicit control over memory, enhancing code clarity and speed by avoiding unnecessary data copies. By using pointers, Go developers can ensure that changes to data are intentional and visible, making the language more efficient and easier to understand once mastered.

https://blog.cubed.run/most-people-dont-understand-why-go-uses-pointers-instead-of-references-bad755dea39f
This article discusses Microsoft's ambitious project to create a native port of the TypeScript compiler and tools, aiming to significantly improve performance. The native implementation promises to reduce build times by up to 10 times and enhance editor responsiveness, making it ideal for large codebases and AI-driven development tools. By mid-2025, a preview of the native tsc is expected, with a full release planned by the end of the year as TypeScript 7.0.

https://devblogs.microsoft.com/typenoscript/typenoscript-native-port/
This blogpost delves into the core concepts of Go's structs and interfaces, highlighting how they differ from traditional object-oriented programming (OOP) languages. It explores Go's philosophy of favoring composition over inheritance and using interfaces to define behavior rather than specify implementation. The article provides practical examples and patterns for using structs and interfaces effectively, emphasizing their role in creating more maintainable and flexible code.

https://getstream.io/blog/go-structs-interfaces/
This blogpost shares a personal journey of learning to write reliable Go code, transitioning from anxiety-filled nights to confident deployments. The author highlights key strategies for building trustworthy code, including robust error handling, comprehensive testing of failure modes, graceful degradation, and built-in monitoring. By adopting these practices, developers can ensure their code is not just functional but also resilient and maintainable, allowing them to commit with confidence and enjoy a worry-free weekend.

https://dev.to/trungdlp/go-code-you-can-trust-sleep-well-after-you-commit-440n
👍1
This blogpost delves into the world of custom marshaling in Go, focusing on how to handle flexible data types that can be either strings or arrays of strings. It demonstrates how to implement yaml.Unmarshaler and yaml.Marshaler interfaces to seamlessly parse and generate YAML data that can represent both single values and lists. The post also extends this approach to JSON, showing how similar techniques can be applied to handle JSON data with the same flexibility.

https://carlosbecker.com/posts/go-custom-marshaling/
This article delves into the strategic decision to migrate TypeScript's compiler from JavaScript to Go, driven by performance and scalability needs. The choice of Go over Rust and C# was influenced by its native code optimization capabilities, automatic garbage collection, and ease of transition from JavaScript. The migration aims to achieve a 10-fold performance improvement, leveraging Go's concurrency features and efficient data structure handling. Despite challenges like maintaining compatibility and redesigning APIs, the project promises significant benefits for the TypeScript ecosystem.

https://dev.to/leapcell/typenoscript-to-go-the-real-reasons-behind-the-10x-typenoscript-416
👍1
This article discusses the introduction of the os.Root API in Go 1.24, designed to prevent path traversal vulnerabilities. Path traversal occurs when an attacker tricks a program into accessing unintended files by manipulating relative paths or symlinks. The os.Root API provides a safe way to operate on files within a specified directory, disallowing operations that escape the root directory. It offers methods for creating, opening, and managing files securely, making it ideal for applications handling untrusted filenames, such as archive extractors.

https://go.dev/blog/osroot
This article provides 11 practical tips for structuring Go projects effectively. It emphasizes that there is no one-size-fits-all approach and encourages developers to adapt their codebase structure based on the project's specific needs. The tips range from using standard layouts as a starting point to avoiding unnecessary directories and keeping related code close together. By following these guidelines, developers can create a well-organized and maintainable codebase that supports efficient development and collaboration.

https://www.alexedwards.net/blog/11-tips-for-structuring-your-go-projects
🔥1
This article compares Go and Rust, two popular programming languages, focusing on their code writing styles, performance, and application areas. Go is praised for its simplicity, efficiency, and excellent concurrency support, making it ideal for network services and cloud computing. Rust, on the other hand, excels in memory safety and high performance, making it suitable for system programming and applications requiring strict security. The article highlights the strengths and weaknesses of each language, providing insights for developers choosing between them for specific projects.

https://dev.to/leapcell/why-is-rust-so-far-behind-go-45cd
👍2
Paul Thorpe's exploration of "cursed Go" features uncovers unconventional or surprising behaviors in the language, from oddities in type inference to unexpected quirks in the standard library. This review encourages readers to approach Go's edge cases with curiosity and a sense of humor.

https://pthorpe92.dev/cursed-go/