Archive · Week 28 · Jul 6 – 12, 2026from 9 items
This week the Go team accepted several proposals that refine existing APIs and deprecate legacy types. The releases for 1.27rc2, 1.26.5, and 1.25.12 also bring security and bug fixes. Overall, the changes focus on improving documentation, simplifying HTTP/2 usage, and adding convenient helpers for URLs, maps, and parsing.
Worth knowingstdlib
x/net/http2: deprecate Transport and Server
- What changed
- The proposal deprecates the
x/net/http2TransportandServertypes, theConfigureServer,ConfigureTransport, andConfigureTransportsfunctions, theClientConnandClientConnStatetypes, and theRoundTripOptandServeConnOptsoption types. - Production impact
- The source does not say.
- Try it
- Run
go doc net/httpto see the deprecation notices for HTTP/2 configuration. - Source
- github.com/golang/go/issues/78064
Explain it and run it
Understand it, then run it
Run it now
// This program shows that HTTP/2 can be used with the standard net/http
// package without importing x/net/http2. It starts a local HTTPS server
// that automatically serves HTTP/2, then makes a request to it using a
// net/http Transport configured for TLS. The output confirms the
// request succeeded and the server responded with status 200.
package main
import (
"crypto/tls"
"fmt"
"net/http"
"net/http/httptest"
)
func main() {
// Create a test HTTPS server that serves HTTP/2 automatically.
server := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello, HTTP/2!")
}))
defer server.Close()
// Configure a client Transport that uses TLS with the server's cert.
transport := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client := &http.Client{Transport: transport}
// Make a request to the test server.
resp, err := client.Get(server.URL)
if err != nil {
fmt.Println("request error:", err)
return
}
defer resp.Body.Close()
// Print the status code to show the request succeeded.
fmt.Println("Response status:", resp.Status)
}
What it printed when we ran it on Go 1.27.1
Response status: 200 OK
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.
Worth knowingtooling
testing: allow examples with any signature
- What changed
- Example functions (
ExampleXxx) that take and/or return parameters are now allowed. They will be shown bygo docbut are not runnable via the playground and cannot contain an// Output:comment. - Production impact
- The source does not say.
- Try it
- Write an
ExampleFoothat takes a*testing.Tand rungo docto see it listed. - Source
- github.com/golang/go/issues/79808
Explain it and run it
Understand it, then run it
Example functions in Go are special functions that start with Example. They are normally used to show how a package works and can be run automatically by the go test tool. The change allows these example functions to have input parameters or return values. They will still appear in the documentation generated by go doc, but they will not be runnable in the playground and cannot contain an // Output: comment. The idea is to let developers write examples that call other functions or return values, while keeping the examples simple to read in the docs.
Run it now
// This program demonstrates that example functions with parameters are now
// allowed in Go. The functions are defined with the `Example` prefix and
// take arguments, but they are not executed automatically by the testing
// framework. We call them manually from main to show that they compile
// and run as normal functions.
package main
import "fmt"
// Example_in_and_out is an example function that takes two integers and
// returns their sum as a string. It is named with the Example prefix,
// so tools like `go doc` will display it as documentation, but it is not
// runnable by the testing package.
func Example_in_and_out(a, b int) string {
return fmt.Sprintf("%d", a+b)
}
func main() {
// Call the example function directly.
fmt.Println(Example_in_and_out(2, 3)) // prints 5
}
What it printed when we ran it on Go 1.27.1
5
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.
Worth knowingecosystem
go1.25.12 release
- What changed
- Security fixes to
crypto/tlsandos, and bug fixes to the compiler, go command, and net and os packages. - Production impact
- The source does not say.
- Try it
- Upgrade to 1.25.12 if you are still on 1.25.x.
- Source
- go.dev/doc/devel/release#go1.25.12
Explain it and run it
Understand it, then run it
Go 1.25.12 is a maintenance release that fixes security problems in the crypto/tls and os packages. It also patches bugs in the compiler, the go command, and the net and os packages. The changes are small and do not add new language features, but they improve the safety and reliability of programs that use TLS or file system operations.
Run it now
// This program demonstrates that the standard library packages `crypto/tls`
// and `os` are available and functional in Go 1.27.1. It does not perform
// any network operations, so it will run successfully in the sandbox.
package main
import (
"crypto/tls"
"fmt"
"os"
)
func main() {
// Verify that we can create a TLS configuration.
cfg := &tls.Config{InsecureSkipVerify: true}
if cfg == nil {
fmt.Println("TLS config creation failed")
return
}
fmt.Println("TLS config created successfully")
// Verify that we can query the current working directory.
dir, err := os.Getwd()
if err != nil {
fmt.Println("os.Getwd error:", err)
return
}
fmt.Println("Current working directory:", dir)
}
What it printed when we ran it on Go 1.27.1
TLS config created successfully Current working directory: /work
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.
Nice to knowstdlib
maps: add Same func
- What changed
- The
mapspackage now has aSamegeneric function that reports whether two maps refer to the same underlying data structure. - Production impact
- The source does not say.
- Try it
- Use
maps.Same(m1, m2)to compare map identities. - Source
- github.com/golang/go/issues/78456
Explain it
Understand it, then run it
After the change ships
go · the proposal's code; it does not compile until the change ships
// This does not compile until the Same function is shipped in Go 1.28.
package main
import (
"fmt"
"maps"
)
func main() {
s := map[int]struct{}{1: {}, 2: {}}
t := s
u := map[int]struct{}{1: {}, 2: {}}
fmt.Println(maps.Same(s, t)) // true
fmt.Println(maps.Same(s, u)) // false
}
Nice to knowtooling
go/parser: add deprecated func ResolveFile(*File)
- What changed
- A deprecated
ResolveFile(*File)function is added to expose the legacy syntactic resolution algorithm used byparser.ParseFilewhenSkipObjectResolutionis false. - Production impact
- The source does not say.
- Try it
- Parse a file with
parser.ParseFileand callparser.ResolveFile(f)to see the resolved identifiers. - Source
- github.com/golang/go/issues/79802
Explain it and run it
Understand it, then run it
The Go parser used to resolve identifiers to the objects they refer to while building the syntax tree. That resolution is now considered legacy and is no longer the default. A new function, ResolveFile, is added to expose that old resolution algorithm. It lets you run the legacy resolution on a file that was parsed without it. The change is only a convenience; it does not alter the language or the compiler.
Run it now
// This program demonstrates the legacy syntactic resolution that is performed
// by the Go parser when parsing with the default mode. It parses a small
// source string, walks the AST, and prints the name of the object each
// identifier refers to. The ResolveFile function is not available in Go
// 1.27.1, so we rely on the parser's default behavior.
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
)
func main() {
src := `
package main
import "fmt"
func main() {
x := 42
fmt.Println(x)
}
`
fset := token.NewFileSet()
// ParseFile with default mode (SkipObjectResolution = false)
file, err := parser.ParseFile(fset, "example.go", src, parser.ParseComments)
if err != nil {
panic(err)
}
// Walk the AST and print identifier resolution info.
ast.Inspect(file, func(n ast.Node) bool {
id, ok := n.(*ast.Ident)
if !ok {
return true
}
if id.Obj != nil {
fmt.Printf("Ident %q resolved to object %q\n", id.Name, id.Obj.Name)
} else {
fmt.Printf("Ident %q has no resolved object\n", id.Name)
}
return true
})
}
What it printed when we ran it on Go 1.27.1
Ident "main" has no resolved object Ident "main" resolved to object "main" Ident "x" resolved to object "x" Ident "fmt" has no resolved object Ident "Println" has no resolved object Ident "x" resolved to object "x"
After the change ships
go · the proposal's code; it does not compile until the change ships
// This code does not compile until the change ships in Go 1.28.
// It demonstrates the use of the new ResolveFile function to perform
// legacy syntactic resolution on a file parsed with SkipObjectResolution.
package main
import (
"go/ast"
"go/parser"
"go/token"
)
func main() {
fset := token.NewFileSet()
file, _ := parser.ParseFile(fset, "example.go", nil, parser.SkipObjectResolution)
parser.ResolveFile(file) // legacy resolution applied
_ = file // use the resolved file
}
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.
Exercise
Write a small program that parses a Go source file, resolves its identifiers using the deprecated ResolveFile helper, and prints the number of resolved identifiers.
The 60-second version
This week the Go team refined several existing APIs and added a few convenience helpers. They deprecate the old HTTP/2 transport and server types in favor of the net/http package, allow example functions to have any signature so documentation can be richer, and introduce a MustParse helper for URLs. In the maps package, a Same function lets you check whether two maps share the same underlying data. The parser package now exposes a deprecated ResolveFile function to aid legacy tooling. Releases for 1.27rc2, 1.26.5, and 1.25.12 bring security fixes and bug patches. These changes keep Go’s ecosystem cleaner and easier to use while maintaining backward compatibility.
Written by gpt-oss-20b · claims checked against the sources · archive, not individually reviewed