Radar · Go · Archive · Week 38 · Sep 15 – 21, 2025
crypto/tls: add QUICEvent.Err
Worth knowingstdlib
- What changed
- The proposal is to add an
Errfield toQUICEventand produce an event with a type ofQUICNoEventand theErrfield set when an error occurs. - Production impact
- The source does not say.
- Try it
- Create a
QUICConnand trigger a handshake error to see aQUICNoEventwithErrpopulated. - Source
- github.com/golang/go/issues/75108
Understand it, then run it
The TLS package in Go can run over QUIC, a transport that needs to know when the handshake fails. Before the change, a QUICConn could only report errors when the caller called a function that returned an error. If an error happened deeper in the handshake, there was no way to surface it. The change adds an Err field to the QUICEvent type. When an error occurs, the library will emit an event whose kind is QUICNoEvent and whose Err field contains the error. This lets code that watches for events know that the connection has failed without having to check every function return value.
Run it now
// This program demonstrates how QUICEvent.Err would be used once the change
// ships. It does not actually create a QUIC connection because that requires
// network I/O, but it shows the structure and how an error would be checked.
package main
import (
"fmt"
)
type QUICEvent struct {
// Set for QUICNoEvent
Err error
// existing fields as-is
}
const (
// QUICNoEvent indicates that there are no events available.
// QUICEvent.Err is set if the connection has encountered a fatal error.
QUICNoEvent = iota
)
func main() {
// Simulate receiving an event with an error.
event := QUICEvent{Err: fmt.Errorf("handshake failed")}
if event.Err != nil {
fmt.Println("Fatal error detected:", event.Err)
} else {
fmt.Println("No error")
}
}
What it printed when we ran it on Go 1.27.1
Fatal error detected: handshake failed
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