π Stories, Tutorials & Articles

medium.com
A step-by-step guide on how to use gqlgen to build efficient APIs in Go with GraphQL.
In summary,REST APIs are limited when it comes to complex data relationships and efficient data retrieval. GraphQL offers a more flexible and efficient way to consume APIs. gqlgen is a schema-first GraphQL library that allows you to build and deploy high-quality GraphQL APIs in Go. It automates the generation of the required Go code for resolvers and data structures from a GraphQL schema. gqlgen is highly configurable and allows you to bypass struct generation and link to pre-existing structures.

www.komu.engineer
A comprehensive guide to OpenTelemetry in Golang. The author has covered all the major aspects of observability, including tracing, metrics, and logging, and has explained how to set up and configure an OpenTelemetry collector to receive, process, and export telemetry data.
The step-by-step instructions provided make it easy for readers to follow along and instrument their own applications for observability.
The author emphasized the importance of correlation between logs, traces, and metrics, and demonstrated how to achieve this correlation by using the same set of attributes when starting a span, taking metrics, and emitting logs. This could quickly help identify the root cause of issues.

blog.lobocv.com
Testing complex workflows in Go can be challenging when dealing with sophisticated fixture setup, multiple edge cases, error handling, mocks, and complex outputs. While the standard library testing package in Go is simple and efficient, many developers turn to supplemental packages to address blind spots when writing tests.
One popular third-party package is stretchr/testify, which provides easy assertions, mocking, and test suite interfaces and functions. The testify/suite package is particularly useful for complex workflows because it provides better test setup, teardown, and organization capabilities.
To illustrate this approach, the author presents a case study of testing a stream processing application that calls the LinkedIn APIs to get organization posts and their lifetime metrics.The author adds by discussing alternatives to this approach, such as table tests and Behavior Driven Testing (BDD).

go.dev
Robert Griesemer discusses the recent language change in Go 1.20, which allows all comparable types to satisfy the predeclared comparable type constraint.
The post explains the background on type parameters and constraints in Go 1.18, how the new type set view is more powerful, the problem with constraint satisfaction, and how the language was changed to differentiate between interface implementation and constraint satisfaction.
The author notes that the exception comes with a cost, as generic functions that rely on comparable are not statically type-safe anymore in Go 1.20. Finally, the post discusses the consequences of the exception and provides a mechanism for enforcing strict comparability in limited form.

www.tigrisdata.com
Tigris is a developer data platform that offers a scalable, cost-efficient, and open source alternative to MongoDB Atlas.
This blog post demonstrates a quickstart Go application that uses the Go driver for MongoDB in a way that is transparent to the application that the data is stored in Tigris Cloud database.
βοΈ Tools, Apps & Software

github.com
Better structured concurrency for go

github.com
JuiceFS is a distributed POSIX file system built on top of Redis and S3.

github.com
A library for calling C functions from Go without Cgo.

github.com
Lightweight static analysis for many languages. Find bug variants with patterns that look like source code.

github.com
A command-line interface (CLI) productivity tool powered by OpenAI's GPT-3 models, will help you accomplish your tasks faster and more efficiently.