Radar · Go · Archive · Week 13 · Mar 23 – 29, 2026
go-blog: Type Construction and Cycle Detection
Nice to knowlanguage
- What changed
- Go 1.26 simplifies type construction and enhances cycle detection for certain kinds of recursive types.
- Production impact
- The source does not say.
- Try it
- Read the blog post to understand the new type‑construction rules and experiment with recursive type definitions in a Go 1.26 environment.
- Source
- go.dev/blog/type-construction-and-cycle-detection
Understand it, then run it
Run it now
// This program demonstrates a simple recursive type that compiles
// thanks to Go 1.26's improved type construction. It prints the
// size of the slice element type to show that the compiler has
// resolved the recursion.
package main
import (
"fmt"
"unsafe"
)
// Node is a recursive type: each node points to another Node.
type Node struct {
next *Node
}
func main() {
// Create a slice of Nodes to exercise the recursive type.
nodes := make([]Node, 3)
// Link the nodes together.
for i := 0; i < 2; i++ {
nodes[i].next = &nodes[i+1]
}
// Print the size of the Node type to confirm the compiler
// has constructed it correctly. The size includes a pointer.
fmt.Printf("Size of Node: %d bytes\n", unsafe.Sizeof(Node{}))
}
What it printed when we ran it on Go 1.27.1
Size of Node: 8 bytes
Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed