Go's Native FIPS 140-3 Crypto Module: A Secure and Simple Solution

2025-07-16

Go 1.24 and later now natively supports FIPS 140-3 compliance through a new cryptographic module developed in collaboration with Geomys. This module, validated by CAVP certificate A6650 and undergoing CMVP review, eliminates previous friction points for Go users in regulated environments. Offering a seamless developer experience, it boasts uncompromising security, using optimized ECDSA and a NIST DRBG based on AES-256-CTR. It supports a wide range of platforms and algorithms, surpassing the capabilities and security of its predecessor, Go+BoringCrypto. This native module provides the easiest and most secure path to FIPS 140-3 compliance for Go developers.

Read more
(go.dev)
Development Cryptographic Module

Go Generics: The Clever Use of Generic Interfaces for Efficient and Adaptive Tree Structures

2025-07-10

This article explores advanced usage of Go's generic interfaces, particularly how to elegantly handle type constraints when building data structures like binary search trees using self-referential generic interfaces. Using a tree structure as an example, it compares three implementation approaches: using `cmp.Ordered`, a custom comparison function, and a self-referential generic interface. Finally, the article delves into combining `comparable` constraints to build ordered sets and avoiding complexities arising from pointer receivers, recommending prioritizing simplicity and readability in design.

Read more
(go.dev)
Development Go Generics

Go's Error Handling Saga: The End of a Syntax War

2025-06-03

After years of attempts to improve Go's verbose error handling, the Go team has decided to abandon efforts to change the language's syntax. Proposals like "check/handle", "try", and the "?" operator all failed to gain widespread consensus. The article details this history, explaining the decision based on the lack of consensus, high implementation costs, and the adequacy of existing approaches. The team argues that focusing on better error handling mechanisms and tools is more productive than pursuing syntactic sugar, emphasizing practicality and readability over code brevity.

Read more
(go.dev)
Development

Go 1.25 Removes Core Types, Simplifying the Language Spec

2025-03-26

Go 1.18 introduced generics, and with it, the concept of "core types" to simplify handling generic operands. However, this added complexity to the language specification and limited the flexibility of certain operations. Go 1.25 removes core types, replacing them with clearer and more concise rules, thereby simplifying the language specification and opening the door for future language improvements, such as more powerful slice operations and improved type inference. This change does not affect the behavior of existing Go programs.

Read more
(go.dev)

Go 1.24 Boosts Wasm Capabilities: WASI Reactors and Exported Functions

2025-02-14

Go 1.24 significantly enhances WebAssembly (Wasm) support with the introduction of the `go:wasmexport` directive and the ability to build WASI reactors. This allows Go developers to export functions to Wasm, enabling seamless integration with host applications. The new WASI reactor mode facilitates continuously running Wasm modules that can react to multiple events or requests without re-initialization. While limitations exist, such as Wasm's single-threaded nature and type restrictions, Go 1.24's improvements pave the way for more powerful and versatile Go-based Wasm applications.

Read more
(go.dev)
Development

Go Protobuf's New Opaque API Improves Performance and Safety

2024-12-16

The Go team released a new Opaque API for Go Protobuf, coexisting with the existing Open Struct API. This new API decouples generated code from its underlying memory representation, leading to performance improvements, reduced memory allocations, and enabling optimizations like lazy decoding. By hiding struct fields and accessing them only through accessor methods, it prevents pointer-related bugs and accidental sharing. Migration involves enabling the Hybrid API, using the `open2opaque` tool, and then switching to the Opaque API. The existing Open Struct API remains supported.

Read more
(go.dev)
Development