Archive · Week 38 · Sep 14 – 20, 2026from 4 items
The Go team accepted three proposals that extend the standard library’s type‑system utilities and the Windows syscall package, and the blog highlighted a new allocation strategy in Go 1.27. The week’s changes mainly add new helpers for type analysis and Windows process creation, and a performance note for small allocations.
Worth knowingstdlib
syscall: update Windows SysProcAttr for recent process creation features
- What changed
- The proposal adds several fields to
syscall.SysProcAttron Windows:Jobs []Handle,Console Handle,Desktop string,AppContainer *AppContainer, andSandbox *Sandbox. It also introduces new typesAppContainerandSandboxthat wrap Windows security and sandbox structures. - Production impact
- The source does not say.
- Try it
- In a Windows build, inspect the
syscall.SysProcAttrstruct to see the new fields. - Source
- github.com/golang/go/issues/80415
Explain it and run it
Understand it, then run it
Run it now
// This program demonstrates that the new fields are not yet available in Go 1.27.1.
// It simply imports syscall, uses the existing SysProcAttr type, and prints its zero value.
// The output shows the struct with no custom fields, confirming the current API state.
package main
import (
"fmt"
"syscall"
)
func main() {
// Create a zero-valued SysProcAttr and print it.
// The struct contains only the fields that are currently defined in Go 1.27.1.
var attr syscall.SysProcAttr
fmt.Printf("Current SysProcAttr: %+v\n", attr)
}
What it printed when we ran it on Go 1.27.1
Current SysProcAttr: {Chroot: Credential:<nil> Ptrace:false Setsid:false Setpgid:false Setctty:false Noctty:false Ctty:0 Foreground:false Pgid:0 Pdeathsig:signal 0 Cloneflags:0 Unshareflags:0 UidMappings:[] GidMappings:[] GidMappingsEnableSetgroups:false AmbientCaps:[] UseCgroupFD:false CgroupFD:0 PidFD:<nil>}
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 knowingstdlib
go/types: add StrictlyComparable function
- What changed
- A new function
StrictlyComparable(T Type) boolwas added togo/types. It reports whether values of typeTare strictly comparable, as defined by the Go spec. - Production impact
- The source does not say.
- Try it
- Use
go/typesto analyze a type and callStrictlyComparableto see if it returns true. - Source
- github.com/golang/go/issues/72059
Worth knowingstdlib
go/types: add Scope.Elements iterator
- What changed
- The
Scopetype now has anObjects() iter.Seq[Object]method that returns an iterator over the objects in a scope in name order. - Production impact
- The source does not say.
- Try it
- Iterate over a
types.Scopewithfor obj := range scope.Objects() { … }. - Source
- github.com/golang/go/issues/80449
Explain it and run it
Understand it, then run it
Run it now
// This program demonstrates how to iterate over the objects in a
// types.Scope in Go 1.27.1, where the proposed Objects() iterator
// is not yet available. It parses a small Go source file, builds
// its type information, and then walks the package scope printing
// each object's name and kind.
//
// In a future release that includes the change, the loop could be
// simplified to:
// for obj := range pkg.Scope().Objects() { ... }
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"go/types"
)
func main() {
// Create a file set and parse a tiny Go source snippet.
fset := token.NewFileSet()
src := `package main
func foo() {}
var x int`
file, err := parser.ParseFile(fset, "example.go", src, 0)
if err != nil {
panic(err)
}
// Set up type checking for the file.
conf := types.Config{Importer: nil}
info := &types.Info{Defs: make(map[*ast.Ident]types.Object)}
pkg, err := conf.Check("example", fset, []*ast.File{file}, info)
if err != nil {
panic(err)
}
// Iterate over the package scope using the existing API.
s := pkg.Scope()
for _, name := range s.Names() {
obj := s.Lookup(name)
fmt.Printf("%s: %s\n", name, obj.Type())
}
}
What it printed when we ran it on Go 1.27.1
foo: func() x: int
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 knowruntime
Size‑Specialized Memory Allocation
- What changed
- Go 1.27 introduces size‑specialized allocation functions that improve performance of small allocations.
- Production impact
- The source does not say.
- Try it
- Run a benchmark that allocates many small objects and observe any change in allocation time.
- Source
- go.dev/blog/size-specialized-allocations
Explain it and run it
Understand it, then run it
Run it now
// This program demonstrates that allocating many small structs is fast
// in Go 1.27.1 thanks to size‑specialized allocation. It measures the
// time to allocate 10 000 000 structs of 16 bytes each and prints the
// average time per allocation in nanoseconds.
package main
import (
"fmt"
"time"
)
type small struct {
a, b uint64 // 16 bytes
}
func main() {
const n = 10_000_000
start := time.Now()
// Allocate a slice of small structs. The runtime will use the
// specialized allocator for 16‑byte objects.
s := make([]small, n)
// Touch the slice to keep the compiler from optimizing away the
// allocation.
for i := range s {
s[i].a = uint64(i)
s[i].b = uint64(i) * 2
}
elapsed := time.Since(start)
avg := float64(elapsed.Nanoseconds()) / float64(n)
fmt.Printf("Allocated %d small structs in %v (%.2f ns each)\n", n, elapsed, avg)
}
What it printed when we ran it on Go 1.27.1
Allocated 10000000 small structs in 152.207314ms (15.22 ns each)
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 program that uses the new StrictlyComparable function to check whether a custom struct type is strictly comparable.
The 60-second version
This week the Go team added a few new helpers to the standard library. In the Windows syscall package, they extended the `SysProcAttr` struct with fields that let you attach a job object list, specify a console, desktop, AppContainer, or sandbox when launching a process. In the type‑system package, two new functions were added: `StrictlyComparable`, which tells you whether a type can be used with the strict comparison operators, and an iterator over the objects in a `Scope`. Finally, the blog highlighted a new allocation strategy in Go 1.27 that speeds up small allocations by using size‑specialized allocation functions. These changes give developers more control over process creation on Windows, richer type analysis tools, and a hint that the runtime is continually improving performance under the hood.
Written by gpt-oss-20b · claims checked against the sources · archive, not individually reviewed