Proposal 81450 suggests letting cgo work without a C toolchain. To try out that idea before it is decided, the Go team will add a cgobindings GOEXPERIMENT. Code that implements the proposed functionality goes behind this experiment flag.
The experiment is off by default. Interested developers can turn it on with GOEXPERIMENT=cgobindings to try the feature and give feedback. If #81450 is accepted, the experiment becomes the default and the flag is removed. If it is rejected, the experiment and all code behind it are deleted.
Proposal 82464 would let go test run extra static analyzers listed in a go.vet file, alongside the built-in vet checks. Before that design is settled, developers need a way to try it and give feedback without the Go team committing to new interfaces or behavior.
This proposal adds a GOEXPERIMENT=vetfiles setting that the go command reads at run time. When it is set, go test enables the prototype support for analyzers specified in go.vet files. The experiment is off by default:
GOEXPERIMENT=vetfiles go test ./...
If #82464 is accepted, the behavior becomes the default and the flag is removed. If it is rejected, the experiment and all code behind it are deleted.
Analyzers that walk the syntax tree with inspector.Cursor often forget to skip parentheses. A check for x == nil might then miss (x) == nil. This proposal adds two Cursor methods that handle parentheses directly.
Cursor.Unparen moves down through any *ast.ParenExpr nodes and returns the cursor for the inner expression, like ast.Unparen. Cursor.UnparenEnclosing moves up past any enclosing parentheses and returns the first ancestor (or the cursor itself) that is not inside a ParenExpr.
// Inspect the real expression, ignoring parens.
switch e := cur.Unparen().Node().(type) {
case *ast.CallExpr:
// ...
}
// Find the real context of an expression, ignoring parens.
if k, _ := cur.UnparenEnclosing().ParentEdge(); k == edge.CallExpr_Fun {
// ...
}
Adding a String or GoString method to an existing standard library type no longer needs a full proposal. Such changes previously waited one to two months for proposal review, even when the method only produced debug output.
The exemption covers methods that return human-readable output and say little about the exact format of the string. These changes still get normal scrutiny in code review. For example, a change like this can go straight to code review:
// String returns a human-readable representation of a Thing suitable for debugging.
func (Thing) String() string
// GoString returns a fuller description of a Thing than [Thing.String].
func (Thing) GoString() string
The x/crypto/openpgp package has been frozen and deprecated since 2021. Its vulnerability entry calls it unsafe by design, with many known security issues, and the Go team rejects bug reports and fixes for it. But the code still lives in the x/crypto repository, so some security scanners flag x/crypto users even when they never import openpgp.
The proposal finishes the deprecation in the usual way: move openpgp into its own nested module, tag a release of that module, and then delete the code from x/crypto. Existing users can keep depending on the tagged module, though they should migrate to a maintained OpenPGP library. Everyone else stops getting scanner warnings about code they don't use.
ACME profiles are an IETF draft extension that lets a client choose which kind of certificate a CA issues, such as a short-lived certificate or one with different validity rules. Let's Encrypt and its Pebble test server already support it. The x/crypto/acme package adds support so clients can discover and request these profiles.
A new ProfileName type names a profile. Directory gains a Profiles map from profile names to their descriptions. If the map is empty, the CA does not support profiles. Order gains a Profile field that reports the profile used. The new WithOrderIssuanceProfile option requests a specific profile when creating an order.
dir, err := client.Discover(ctx)
if err != nil {
return err
}
if _, ok := dir.Profiles["shortlived"]; ok {
order, err := client.AuthorizeOrder(ctx, ids,
acme.WithOrderIssuanceProfile("shortlived"))
// ...
}
The golang.org/x/net/http2/h2c package serves unencrypted HTTP/2 (h2c) connections. It is deprecated because Go 1.24's net/http supports unencrypted HTTP/2 directly, on both the client and the server.
To serve h2c, add UnencryptedHTTP2 to Server.Protocols. To make h2c requests to http:// URLs, set Transport.Protocols to include UnencryptedHTTP2 but not HTTP1.
var p http.Protocols
p.SetHTTP1(true)
p.SetUnencryptedHTTP2(true)
srv := &http.Server{Addr: ":8080", Handler: h, Protocols: &p}
net/http supports only the "prior knowledge" method, where the client starts speaking HTTP/2 right away. It does not support the Upgrade: h2c mechanism from HTTP/1.1, and there are no plans to add it. RFC 9113 deprecates that mechanism. The h2c package's implementation of it was buggy, untested, and read the whole first request into memory. After this change, no non-deprecated Go package supports h2c upgrade.
Client.CreateOrderCert takes only the order's finalize URL. After finalizing, it reads the order URL from the response's Location header so it can poll the order. RFC 8555 does not require that header in finalize responses. Let's Encrypt sends it, but some CAs (such as Buypass) and the Pebble test server do not. With those servers, polling fails.
The new Client.CreateCertFromOrder method takes the *Order returned by AuthorizeOrder instead of a URL. It posts the CSR to Order.FinalizeURL and polls Order.URI, so it no longer needs the Location header. It returns an error if either field is empty. CreateOrderCert stays as it is, but its documentation will warn that it only works with CAs that send the header and will point users to the new method. autocert can switch to the new method.
#78064 · x/net/http2 · medium impact ·
Implemented ·
The Transport and Server types in golang.org/x/net/http2 will be deprecated. Every feature they support is now available through public APIs in net/http, so users no longer need them.
The following are deprecated:
Transport and Server, including their fields and methods.
ConfigureServer, ConfigureTransport, and ConfigureTransports. Use net/http settings instead.
ClientConn and ClientConnState. Use net/http.ClientConn instead.
To get an HTTP/2-only client or server, configure the net/httpTransport or Server directly:
Formatting a pointer with %d prints its address as decimal digits. In practice this is almost always a bug: the author forgot to dereference a pointer to an integer. fmt accepts it and can't change, so the vet check will be stricter than fmt.
The printf vet check will now report any use of the %d verb with a pointer argument. To print the integer, dereference the pointer. If you really want the address in decimal, convert it to uintptr first.
n := new(int)
fmt.Printf("%d\n", n) // vet: %d with pointer
fmt.Printf("%d\n", *n) // OK: prints the value
fmt.Printf("%d\n", uintptr(unsafe.Pointer(n))) // OK: address in decimal