Proposals Unofficial Go proposal tracker

What's coming in Go

Proposals implemented for the next Go release, proposals accepted but not implemented yet, and proposals likely to be accepted soon.

Implemented Accepted Likely accept Collapse all

Go 1.28 25 proposals

Already merged and almost certain to ship.

Allow composite literals without an explicit type

#12854 · spec · high impact · Implemented in Go 1.28 ·

Go lets you omit the type of a composite literal only in a few places, such as elements nested inside a slice or map literal. Everywhere else you must spell out the type, even when the compiler already knows it. This is verbose with long type names like generated protobuf types, and it rules out anonymous struct types for things like function arguments.

The proposal makes the type in a composite literal optional. An untyped literal {...} is assignable to a type T if T{...} with the same elements would be a valid composite literal of type T. Pointer types are handled the same way. The literal has no default type, so x := {1, 2, 3} is an error. This replaces the spec's special rules for eliding element types.

var m map[string]int = {"a": 1}

type Args struct{ A, B, C int }
func Foo(args Args) { ... }
Foo({A: 1, B: 2, C: 3})

return {}, err // instead of time.Time{}, err

p.Options = append(p.Options, {...}) // type inferred from the slice

Report missing Err calls after bufio.Scanner and sql.Rows loops

#17747 · cmd/vet · medium impact · Implemented in Go 1.28 ·

Code that loops over a bufio.Scanner or sql.Rows often forgets to call Err() afterward. The loop then ends silently on an I/O or database error, and the program treats partial results as complete.

A new vet check reports uses of bufio.Scanner where Err() is never called. It skips scanners whose underlying reader cannot fail, such as bytes.Buffer or strings.Reader. A similar analyzer reports missing Err() calls on sql.Rows. Both analyzers run in gopls and are part of the default go vet suite.

s := bufio.NewScanner(f)
for s.Scan() {
    process(s.Text())
}
// vet: s.Err() is never checked
if err := s.Err(); err != nil { // add this
    return err
}

Add flag iterators

#65675 · flag · medium impact · Implemented in Go 1.28 ·

The flag package lets you walk flags only with Visit (set flags) and VisitAll (all flags). Both take callbacks that can't stop early, so they don't fit Go's range-over-func iterators.

The proposal adds a package-level All function and a FlagSet.All method. Both return an iter.Seq[*Flag] that yields flags in lexicographical order. Instead of a separate iterator for set flags, the Flag struct gets a new IsSet field that reports whether the flag was set on the command line.

for f := range flag.All() {
    if f.IsSet {
        fmt.Printf("%s = %s\n", f.Name, f.Value)
    }
}

Add Grow to presize an existing map

#81698 · maps · medium impact · Implemented in Go 1.28 ·

Go code can presize a new map with make(M, hint), but a map that already exists grows one rehash at a time. Code that merges many entries into a map it doesn't own pays for every intermediate grow. Examples include copying headers into ResponseWriter.Header(). Presizing before a copy measured 53–65% faster.

The new maps.Grow function grows an existing map in place so that at least n more entries fit without further growth, as if the map had been created with make(M, len(m)+n). This is best effort: it cannot guarantee that no more growth will happen.

func Grow[M ~map[K]V, K comparable, V any](m M, n int)

maps.Grow(dst, len(src))
for k, v := range src {
	dst[k] = v
}

maps.Copy(dst, src) will also pre-grow dst to fit len(src) new entries, so existing callers of Copy get the speedup without code changes.

Add text marshaling to HardwareAddr and IPMask

#29678 · net · medium impact · Implemented in Go 1.28 ·

net.HardwareAddr and net.IPMask are byte slices without text marshaling methods. Because of this, encoding/json encodes them as base64 and can't decode readable strings like "ab:cd:ef:ab:cd:ef". net.IP already marshals to readable text, so this behavior is inconsistent.

The proposal adds MarshalText and UnmarshalText methods to HardwareAddr and IPMask. UnmarshalText accepts both the old base64 form and the readable form, whatever the setting. MarshalText produces the readable form only when GODEBUG=netmarshal=1 is set. HardwareAddr uses its String output. IPMask is formatted as an IP address, such as 255.255.255.0, because IPMask.String output can look like base64. At first, netmarshal defaults to off, so the output stays base64. At least two releases later, the default flips to readable output. IPNet is not included.

var v struct{ MAC net.HardwareAddr }
json.Unmarshal([]byte(`{"MAC":"ab:cd:ef:ab:cd:ef"}`), &v) // now works

Add MustParse function that panics on invalid URLs

#79946 · net/url · medium impact · Implemented in Go 1.28 ·

Many programs parse URLs that are known to be valid, such as constants in code or test fixtures. Today they must handle an error that never happens, or write their own mustParse helper (which they often do).

The proposal adds url.MustParse, which works like url.Parse but panics if parsing fails. It follows the pattern of regexp.MustCompile and netip.MustParseAddr. It is meant for package-level variables and tests.

var apiBase = url.MustParse("https://api.example.com/v1/")

func endpoint(path string) *url.URL {
    return apiBase.JoinPath(path)
}

Add iterator versions of regexp FindAll methods and Split

#61902 · regexp · medium impact · Implemented in Go 1.28 ·

Regexp's FindAll* methods collect every match into a slice, even when the caller only wants to loop over the matches or stop early. This proposal adds iterator versions that return matches one at a time, without building the slice.

Each FindAll* method gets an equivalent named by dropping the Find prefix: All, AllIndex, AllString, AllSubmatch, etc. Each returns an iter.Seq of the type the matching non-All method returns. For example, AllString returns iter.Seq[string] and AllStringSubmatch returns iter.Seq[[]string]. A new SplitSeq method mirrors Split, the same way strings.SplitSeq mirrors strings.Split.

re := regexp.MustCompile(`\d+`)
for m := range re.AllString("a1 b22 c333") {
    fmt.Println(m) // 1, 22, 333
}

for part := range re.SplitSeq("a1b22c") {
    fmt.Println(part) // a, b, c
}

Add a memory profile type

#79179 · runtime/pprof · medium impact · Implemented in Go 1.28 ·

Developers investigating memory usage usually start with process RSS and then look at the heap profile. The live heap often covers less than half of a Go program's memory. It leaves out dead (unreachable but not yet swept) heap objects, goroutine and thread stacks, runtime metadata, and non-Go memory such as cgo allocations and mmap regions. Users today must reconcile RSS, runtime metrics, and the heap profile by hand.

The new memory profile type in runtime/pprof gives one consistent breakdown, taken at the most recent GC mark termination. A "Go Memory" frame splits into heap (live and dead, both with allocation stack traces), stacks (goroutines and OS threads), and runtime overhead (span and mcache metadata, GC metadata, profiling buckets, and other). Its total equals /memory/classes/total:bytes minus /memory/classes/heap/released:bytes.

pprof.Lookup("memory").WriteTo(f, 0)

When the OS reports RSS and RSS is at least Go Memory, the profile adds a "Non-Go Memory" frame equal to RSS minus Go Memory. Otherwise it omits that frame and adds a warning comment to the profile.

Restrict integer-to-string conversions to byte and rune

#3939 · spec · medium impact · Implemented in Go 1.28 ·

Go lets you convert any integer to a string, producing the UTF-8 encoding of that code point. This is a historical leftover. It confuses readers, who often expect string(65) to produce "65" rather than "A". Invalid code points such as 0xD800 silently become "\uFFFD". go vet has flagged these conversions for years.

Starting with language version 1.28, a conversion from an integer to a string will be allowed only if the integer has type byte or rune, or is an untyped rune constant. Converting other integer types, such as int, int64 or uint32, becomes a compile error. Byte and rune slice conversions are unchanged.

var i int = 65
s := string(i)        // error in Go 1.28
s = string(rune(i))   // OK: "A"
s = strconv.Itoa(i)   // OK: "65"
s = string('A')       // OK: untyped rune constant

Add sharded Counter type for scalable concurrent counting

#80645 · sync · medium impact · Implemented in Go 1.28 ·

A single atomic counter becomes a bottleneck on machines with many CPUs, because every update fights over the same cache line. The new generic sync.Counter type splits the counter into per-CPU shards (one per P, up to GOMAXPROCS). It is meant for counters that are updated often and read rarely.

Concurrent Add calls update only their local shard, so writes stay fast under heavy contention. Value sums all shards, so its cost grows with GOMAXPROCS. It is race-free, but while writers are active it returns an approximate total, not a consistent snapshot. Add does not create a happens-before relationship, so don't use it for synchronization. Overflow wraps around. If GOMAXPROCS shrinks, existing shards are kept, so no counts are lost.

var requests sync.Counter[int64]

func handle() {
    requests.Add(1) // fast, even from many goroutines
}

func report() {
    fmt.Println(requests.Value()) // slower; approximate under concurrent writes
}

The type parameter accepts ~int64, ~uint64, and ~float64.

Add Subtest to run a subtest in a synctest bubble

#77320 · testing/synctest · medium impact · Implemented in Go 1.28 ·

Tests that use synctest often run each case as a subtest inside a bubble. That means nesting synctest.Test inside t.Run, which adds an extra level of indentation on top of the table-driven loop. Some developers write their own helper to avoid this.

The new synctest.Subtest function runs f in a bubble as a subtest of t named name. It is equivalent to calling t.Run with a function that calls synctest.Test.

for _, test := range tests {
    synctest.Subtest(t, test.name, func(t *testing.T) {
        // test body runs in a synctest bubble
    })
}

Stop converting plain quotes to smart quotes in doc comments

#76975 · cmd/gofmt · low impact · Implemented in Go 1.28 ·

Since Go 1.19, gofmt rewrites doc comments so that a pair of backquotes (``) becomes a left smart quote (“) and a pair of single quotes ('') becomes a right smart quote (”). This silently changes comment text into characters that are hard to type and easy to confuse with the originals. It also breaks code examples that use these characters and makes the original text impossible to find by searching.

The change removes smart-quote conversion entirely. go/format (and so gofmt and go fmt) will no longer insert smart quotes into source files. go/doc (and so go doc and pkgsite) will also stop converting plain quotes when rendering documentation, so the two stay consistent.

Deprecate the unused ImportDirectory type

#81594 · debug/pe · low impact · Implemented in Go 1.28 ·

The debug/pe.ImportDirectory type will be marked deprecated. It was added about 15 years ago, but no function or field in the package ever returns or accepts it, so it has never been usable.

The type stays in the package for compatibility. A // Deprecated: comment will tell tools and linters to flag any remaining uses. No functionality is removed.

Move analysis framework types into the standard library

#82465 · go/analysis · low impact · Implemented in Go 1.28 ·

The analysis framework, golang.org/x/tools/go/analysis, defines how analyzers (linters) talk to drivers like cmd/vet. The Go toolchain uses a vendored copy of it, and the copy's types are distinct from the x/tools ones. This blocks proposal 82464, which lets go test run the analyzers specified by the workspace. To do that, go test must build vet-like tools that link with third-party analyzers, and those analyzers are written against the x/tools types.

The proposal moves the framework's types, unchanged, into a new standard library package, go/analysis. The x/tools types become aliases of them, so the toolchain and x/tools share the same types, and existing analyzers keep working as is. The API is not redesigned: the move is the only change.

import "go/analysis"

var Analyzer = &analysis.Analyzer{
	Name: "mycheck",
	Doc:  "reports something",
	Run: func(pass *analysis.Pass) (any, error) {
		pass.Reportf(pass.Files[0].Pos(), "found it")
		return nil, nil
	},
}

The package and the aliases will first ship behind a GOEXPERIMENT flag.

Deprecate ArchChar

#75129 · go/build · low impact · Implemented in Go 1.28 ·

go/build.ArchChar once returned the single-character code for an architecture (such as 6 for amd64), which the old toolchain used in tool names like 6g. Since Go 1.5, the toolchain no longer uses these codes. The function now always returns an error, whatever the architecture.

The proposal marks ArchChar as deprecated so that linters and editors warn about it. It has no replacement, and new code should not call it.

// Deprecated: Since Go 1.5 ArchChar always returns an error.
func ArchChar(goarch string) (string, error)

Add deprecated ResolveFile to apply object resolution after parsing

#79802 · go/parser · low impact · Implemented in Go 1.28 ·

Legacy object resolution in go/parser is deprecated. It fills Ident.Obj and File.Scope and is skipped with the SkipObjectResolution mode flag. Some tools still need it occasionally, though. For example, gopls parses without resolution for speed, but must still resolve files before passing them to analyzers. To do that, it keeps its own copy of the parser's resolution algorithm.

The new deprecated function parser.ResolveFile exposes the parser's internal algorithm. It applies resolution to an already parsed file. It is idempotent: calling it more than once is safe, and a sync.Once inside ast.File guards the work.

f, err := parser.ParseFile(fset, "x.go", src, parser.SkipObjectResolution)
// ...later, only when needed:
parser.ResolveFile(f) // fills f.Scope and Ident.Obj

New code should use go/types instead. The function exists to ease migration for programs that disable resolution by default.

Add CommonUnderlying function to report a type's shared underlying type

#60994 · go/types · low impact · Implemented in Go 1.28 ·

Tools built on go/types often need the single underlying type shared by every type in a type parameter's type set. This concept was called the core type. go/types computes it internally but does not export it, so x/tools and other projects have each reimplemented the logic.

The proposal adds an exported function, CommonUnderlying, that returns the common underlying type of a type. For an ordinary type, the result is its underlying type. For a type parameter, the result is the underlying type shared by all types in its type set. If no such type exists, the function returns nil.

// T is a type parameter constrained by ~[]int | MySlice
if u := types.CommonUnderlying(T); u != nil {
    if s, ok := u.(*types.Slice); ok {
        fmt.Println("element type:", s.Elem())
    }
}

Add StrictlyComparable function

#72059 · go/types · low impact · Implemented in Go 1.28 ·

Go has two notions of comparability. A type is comparable if == compiles for it, even if it might panic at run time, as with interfaces. A type is strictly comparable if == never panics. Only strictly comparable types satisfy the comparable constraint in all cases.

An exported type can lose strict comparability without any visible API change, for example by gaining an interface field. That can break callers that use it as a type argument for comparable. go/types exposes Comparable but has no way to check strict comparability, so API-checking tools cannot detect such changes.

The proposal adds types.StrictlyComparable, which reports whether values of a type are strictly comparable as defined by the spec.

func StrictlyComparable(T Type) bool

// Example: a struct with an interface field is comparable but not strictly comparable.
if types.Comparable(t) && !types.StrictlyComparable(t) {
    fmt.Println("== may panic at run time")
}

Add NewTypeParamList and NewTypeList constructors

#79603 · go/types · low impact · Implemented in Go 1.28 ·

Code that works with generic methods sometimes needs to treat the receiver's and the method's type parameters as one list. go/types has no exported way to build a *TypeParamList or *TypeList. Tools like the compiler's noder copy lists into slices. x/tools/go/ssa even uses an unsafe cast that depends on the internal layout of TypeParamList.

The proposal adds two constructors to go/types. NewTypeParamList builds a *TypeParamList from type parameters, and NewTypeList builds a *TypeList from types.

func concat(recv, meth *types.TypeParamList) *types.TypeParamList {
    var all []*types.TypeParam
    for tp := range recv.TypeParams() {
        all = append(all, tp)
    }
    for tp := range meth.TypeParams() {
        all = append(all, tp)
    }
    return types.NewTypeParamList(all...)
}

args := types.NewTypeList(types.Typ[types.Int], types.Typ[types.String])

Add Scope.Objects iterator

#80449 · go/types · low impact · Implemented in Go 1.28 ·

Code that walks the objects in a types.Scope usually loops over Scope.Names() and calls Lookup for each name. This pattern appears dozens of times in x/tools alone.

The proposal adds a Scope.Objects method that returns an iterator. It yields the scope's objects in name order.

for obj := range pkg.Scope().Objects() {
	fmt.Println(obj.Name(), obj.Type())
}

Add FMA32 for single-precision fused multiply-add

#82653 · math · low impact · Implemented in Go 1.28 ·

Go has no correct, fast way to compute a single-precision fused multiply-add. The obvious float32(math.FMA(float64(x), float64(y), float64(z))) rounds twice: once to float64 and again to float32. That can give a different result from a true fused operation. Writing x*y + z may compile to a fused instruction, but the spec allows this without requiring it, so results vary by platform and compiler.

The proposal adds math.FMA32. It computes x*y + z as if with infinite precision and rounds only once:

func FMA32(x, y, z float32) float32

r := math.FMA32(a, b, c) // a*b + c, rounded once to float32

Like math.FMA, the compiler turns it into a single inlined hardware instruction where one is available. This covers arm64, loong64, ppc64x, riscv64, s390x, amd64 (with FMA support) and arm (with VFPv4). On 386, mips and wasm it uses a pure-Go software fallback.

Mark DNSConfigError as deprecated

#63118 · net · low impact · Implemented in Go 1.28 ·

The net.DNSConfigError type has not been used by the net package for years. Its doc comment says "No longer used; kept for compatibility," but it lacks a formal deprecation notice. As a result, tools like staticcheck and gopls don't warn code that still references it.

The proposal adds a standard Deprecated: comment to the type. The type stays in the package for compatibility, so existing code keeps compiling.

// DNSConfigError represents an error reading the machine's DNS configuration.
//
// Deprecated: No longer used; kept for compatibility.
type DNSConfigError struct {
    Err error
}

Add Server.HandleRequest to apply server processing to external requests

#77441 · net/http · low impact · Implemented in Go 1.28 ·

Before passing a request to the user's handler, http.Server does some extra work. It answers OPTIONS * requests, falls back to DefaultServeMux when Server.Handler is nil, and recovers and logs panics. Code that receives requests some other way, such as an HTTP/3 server or a test, can't reuse this logic and has to copy it.

The new Server.HandleRequest method handles a request as if the server had received it, applying the same behavior.

func (s *h3Server) serveRequest(w http.ResponseWriter, r *http.Request) {
    if err := s.httpServer.HandleRequest(w, r); err != nil {
        // handler panicked; reset the stream
        s.resetStream(r)
    }
}

Add MethodQuery constant for the HTTP QUERY method

#80058 · net/http · low impact · Implemented in Go 1.28 ·

RFC 10008 defines the HTTP QUERY method. Like GET, it is safe and idempotent. Like POST, it carries a request body. This makes it useful for complex queries or large or binary query data that don't fit well in a URL. The method was previously known as SEARCH, but it was renamed before the RFC was published.

The net/http package adds a MethodQuery constant alongside MethodGet, MethodPost, MethodPatch, and the others:

const MethodQuery = "QUERY"
req, err := http.NewRequest(http.MethodQuery, "https://example.com/search", body)

The proposal only adds the constant. Any QUERY-specific behavior, such as Content-Length handling or redirects, would be handled separately.

Add Landlock sandboxing and NoNewPrivs to SysProcAttr on Linux

#68595 · syscall · low impact · Implemented in Go 1.28 ·

On Linux, programs that run untrusted work through os/exec often want the child process to have fewer privileges than the parent. For example, a server might run git on untrusted repositories and want git to touch only one temporary directory. Landlock is a Linux kernel feature that restricts file access. Until now, Go had no safe way to apply it to a child process only, because forking manually is hard with Go's threaded runtime.

The proposal adds new fields to syscall.SysProcAttr on Linux. When UseLandlock is set, the child calls landlock_restrict_self(LandlockFD, LandlockFlags) before exec. LandlockFD is a ruleset file descriptor, which can come from a library such as go-landlock. A new NoNewPrivs field calls prctl(PR_SET_NO_NEW_PRIVS) before exec.

cmd := exec.Command("git", "clone", url, tmpDir)
cmd.SysProcAttr = &syscall.SysProcAttr{
    NoNewPrivs:  true,
    UseLandlock: true,
    LandlockFD:  rulesetFD, // e.g. allows only /usr (read) and tmpDir (read-write)
}
err := cmd.Run()

Accepted 22 proposals

Accepted, not implemented yet. Most land in the next one or two releases.

Support expectations for related information in want comments

#75800 · x/tools/go/analysis/analysistest · low impact · Accepted ·

Analyzer tests written with analysistest can check diagnostic messages and facts through // want comments. They cannot check a diagnostic's related information (analysis.Diagnostic.Related). Today, authors must inspect the returned Result by hand.

The proposal adds two things:

  • A new // anchor <name> comment that names a line.
  • A new want field, @<anchor>:<regexp>, which expects a related information entry on the anchored line whose message matches the regexp.
var x int // anchor decl

func f() {
    x := 1 // want "x shadows outer variable" @decl:"declared here"
}

Add sorted Map and Set types ordered by key (experimental)

#60630 · x/exp/collection/sorted · medium impact · Accepted ·

Go has no standard container that keeps keys in sorted order. Many projects write their own tree map or ordered set. Similar types exist in other languages, such as C++ std::map, Java SortedMap, and Rust BTreeMap.

The proposal adds a new package, golang.org/x/exp/collection/sorted, with generic Map[K, V] and Set[T] types. Both are created with a comparison function (such as cmp.Compare) that defines the order. They support insert, lookup, delete, min and max, access by index, and iteration in ascending or descending order. Range queries use span types (MapSpan and SetSpan) that cover the part of the collection between optional bounds.

m := sorted.NewMap[string, int](cmp.Compare)
m.Set("cherry", 7)
m.Set("apple", 5)
m.Set("banana", 3)

for k, v := range m.All() {
    fmt.Println(k, v)
}
// apple 5
// banana 3
// cherry 7

// Keys from "b" (inclusive) to "c" (exclusive).
for k := range m.From("b").Below("c").Keys() {
    fmt.Println(k)
}
// banana

Add generic collection packages (experimental)

#80590 · x/exp/collection · medium impact · Accepted ·

Go has few library collection types. Sets are usually written as map[T]bool or map[T]struct{}, ordered maps don't exist, and container/heap is awkward to use. This umbrella proposal adds a family of generic collection packages to golang.org/x/exp, so the community can try them before they move into the standard library.

The new types are:

See individual proposals for more details.

Add generic Set with custom hashing and equality (experimental)

#80584 · x/exp/collection/hashed · low impact · Accepted ·

Go's built-in maps compare keys with ==, so a set built on a map cannot hold elements whose equality is defined some other way. For example, two types.Type values can be identical according to types.Identical but still differ under ==.

The proposal adds a generic Set[E] hash table in the experimental golang.org/x/exp/collection/hashed package, the set counterpart of hashed.Map. NewSet takes a maphash.Hasher[E], which supplies a hash function and an equality check for elements. The set offers Insert, Contains, Delete, and other set operations. It also provides the All iterator.

Set operations Union, Intersection, Difference, and SymmetricDifference return a new set, and their ...With variants update the receiver; Intersects reports whether two sets share an element. Elements must not be (or contain) NaN floats.

type typeHasher struct{}

func (typeHasher) Hash(h *maphash.Hash, t types.Type) {
    // hash t consistently with Identical
}
func (typeHasher) Equal(x, y types.Type) bool {
    return types.Identical(x, y)
}

s := hashed.NewSet[types.Type](typeHasher{})
s.Insert(t1)
s.Insert(t2) // false if t2 is identical to t1
fmt.Println(s.Contains(t1), s.Len())
for t := range s.All() {
    fmt.Println(t)
}

For elements with the usual == equality, set.Set remains the right choice.

Add Deprecated function to parse deprecation notices in doc comments

#80118 · go/ast · low impact · Accepted ·

Go tools such as gopls and static analyzers detect deprecated symbols by looking for comments that start with "Deprecated:". The rules for this format lived on a wiki page, and each tool implemented its own parsing. This proposal makes one official definition and adds a standard function that tools can share.

The go/doc package gains a Deprecated function. It returns the notice text without the "Deprecated: " prefix, or "", false if there is no notice. Its input can be Func.Doc, Package.Doc, Type.Doc, or Value.Doc.

for _, f := range pkg.Funcs {
    if text, ok := doc.Deprecated(f.Doc); ok {
        fmt.Printf("%s is deprecated: %s\n", f.Name, text)
    }
}

Add generic Map with custom hashing and equality (experimental)

#69559 · x/exp/collection/hashed · low impact · Accepted ·

Go's built-in maps compare keys with ==, so they cannot handle keys whose equality is defined some other way. For example, two types.Type values can be identical according to types.Identical but still differ under ==.

The proposal adds a generic Map[K, V] hash table in the experimental golang.org/x/exp/collection/hashed package. NewMap takes a maphash.Hasher[K], which supplies a hash function and an equality check for keys. Equal keys must produce equal hashes. The map offers Set, Get, Lookup, Contains, and other map operations. It also provides the All, Keys, and Values iterators.

type typeHasher struct{}

func (typeHasher) Hash(h *maphash.Hash, t types.Type) {
    // hash t consistently with Identical
}
func (typeHasher) Equal(x, y types.Type) bool {
    return types.Identical(x, y)
}

m := hashed.NewMap[types.Type, string](typeHasher{})
m.Set(t, "info")
fmt.Println(m.Get(t), m.Len())
for k, v := range m.All() {
    fmt.Println(k, v)
}

For keys with the usual == equality, the built-in map remains the right choice.

Add a generic Set type (experimental)

#69230 · x/exp/collection/set · high impact · Accepted ·

Go has no standard set type. Developers usually write map[T]struct{} or map[T]bool and reimplement operations like union and intersection by hand. This proposal adds a generic Set type in the experimental package golang.org/x/exp/collection/set. It gives the community a shared implementation to try before any set type reaches the standard library.

Set[E comparable] is defined as map[E]struct{}, so it works with range, len, and other map operations. Sets are created with Of (from values) or Collect (from an iterator). Methods cover insert, delete, membership checks, iteration, and set operations: union, intersection, difference, and symmetric difference. Each set operation has a version that returns a new set (Union) and one that updates the receiver (UnionWith).

x := set.Of(1, 2, 3)
y := set.Of(3, 4, 5)

fmt.Println(x.Union(y))        // {1, 2, 3, 4, 5}
fmt.Println(x.Intersection(y)) // {3}

x.Insert(10)
x.Delete(1)
fmt.Println(x.Contains(10), x.Len()) // true 3

// A Set is a map, so range works directly.
for elem := range y {
    fmt.Println(elem)
}

Separate compiler export data from the format used by tools

#79427 · low impact · Accepted ·

Export data is the compact binary form of a package's type information. Today the compiler writes its own "unified" format, while x/tools (including gopls) uses an "indexed" format. Because go list -export runs the compiler, x/tools must also read the compiler's format. This couples the two and makes it hard for the compiler to change its format.

The proposal fully separates the two formats. The compiler will read and write only its own format, and only for the same toolchain version. That format becomes an internal detail with no supported reader, so it can change at any time. The Export field from go list -export will instead point to a file in the tools format. A new tool, cmd/export, will produce these files. It is built on go/ast, go/types, and vendored x/tools, and it type-checks a package and writes its export data.

Tools that run the compiler directly and read its export data must switch to go list -export or run cmd/export. x/tools will keep reading older compiler output for two more releases, following its usual support window.

Deprecate and remove execabs in favor of os/exec

#64047 · x/sys/execabs · low impact · Accepted ·

The x/sys/execabs package was added in 2021 to fix a security issue. Without it, os/exec could run a program found in the current directory when looking up a command name in PATH. Since Go 1.19, os/exec refuses such relative path lookups by default, so execabs is no longer needed.

The package will be marked deprecated, and its functions will get //go:fix directives so tools can automatically rewrite calls to use os/exec. Eventually, x/sys/execabs will be removed.

// Before
import "golang.org/x/sys/execabs"
cmd := execabs.Command("git", "status")

// After
import "os/exec"
cmd := exec.Command("git", "status")

Add goroutine labels identifying the running test

#75047 · testing · medium impact · Accepted ·

When several tests hang and time out, the goroutine dump does not show which goroutine belongs to which test. This makes timeouts hard to debug and hides tests that spawn many goroutines.

The testing package will now set two goroutine labels automatically on every test, example, benchmark, and fuzz test:

  • test.name: the unqualified name of the test function.
  • test.iter: an identifier unique to each run of the test function (usually the iteration count).

Goroutines started by the test inherit these labels.

func TestFoo(t *testing.T) {
    v, _ := pprof.Label(t.Context(), "test.name") // "TestFoo"
    _ = v
}

Add a unified SignerV2 API to the ssh package

#74424 · x/crypto/ssh · low impact · Accepted ·

The ssh package has three overlapping signer interfaces (Signer, AlgorithmSigner, MultiAlgorithmSigner) and several overlapping constructors and parsers. They grew over time to handle RSA's multiple signature algorithms and DSA keys. The proposal adds a V2 API that will replace the old one when the package moves to the standard library. Users can try it now.

SignerV2 combines the three interfaces into one. It has PublicKey, Sign, SignContext (which takes a context and an optional algorithm), Algorithms, and Signer, which returns the underlying crypto.Signer if one is available. You create one with NewSignerV2 from any crypto.Signer; for RSA keys it excludes SHA-1 algorithms by default.

The V2 API drops DSA keys and legacy RFC 1423 PEM encryption. SignerV2 remains compatible with the existing Signer interface.

signer, err := ssh.ParsePrivateKeyV2(pemBytes, &ssh.ParsePrivateKeyV2Options{
    Passphrase: "secret",
})
if err != nil {
    return err
}
sig, err := signer.SignContext(ctx, rand.Reader, data, ssh.KeyAlgoRSASHA256)

Add new options to Windows SysProcAttr

#80415 · syscall · low impact · Accepted ·

Package syscall is mostly frozen, but process creation is an exception: without it, using new Windows process features through os/exec would mean forking both syscall and os/exec. This proposal lets Windows callers set the job object list, console, desktop, AppContainer, and experimental sandbox for a new process (using syscall.SysProcAttr).

cmd := exec.Command("tool.exe")
cmd.SysProcAttr = &syscall.SysProcAttr{
    Jobs:    []syscall.Handle{job},
    Desktop: `winsta0\default`,
    AppContainer: &syscall.AppContainer{
        SID:          containerSID,
        Capabilities: caps,
    },
}
err := cmd.Run()

Make Transport.CancelRequest a no-op

#79040 · net/http · low impact · Accepted ·

Transport.CancelRequest has been deprecated since Go 1.6. It never worked for HTTP/2 requests. Supporting it for HTTP/1 is expensive: the transport must track every in-flight request in a map, just in case a caller wants to cancel one. Code that never calls CancelRequest pays this cost too.

Transport.CancelRequest will become a no-op. On its first call, it logs a one-time warning. To cancel requests, use a context instead:

ctx, cancel := context.WithCancel(context.Background())
req, _ := http.NewRequestWithContext(ctx, "GET", url, nil)
go func() { /* ... */ cancel() }()
resp, err := client.Do(req)

Setting GODEBUG=httptransportcancelrequest=1 restores the old behavior for four release cycles. After that, support is removed entirely.

Add atomic Max and Min operations

#63999 · sync/atomic · medium impact · Accepted ·

Programs sometimes need to atomically record the largest or smallest value seen so far, such as a peak counter or a high-water mark shared across goroutines. Today this requires a hand-written compare-and-swap loop. This proposal adds atomic Max and Min operations to sync/atomic. Some architectures, such as RISC-V with AMOMAX/AMOMIN, can implement them with a single instruction.

The new functions are MaxInt32, MaxInt64, MaxUint32, MaxUint64, MaxUintptr and the matching Min* functions. The Int32, Int64, Uint32, Uint64 and Uintptr types gain matching Max and Min methods. Each operation stores the larger or smaller of the current value and val, then returns the old value.

var peak atomic.Int64

func record(n int64) {
    peak.Max(n) // peak = max(peak, n), atomically
}

var lowest int32 = math.MaxInt32
old := atomic.MinInt32(&lowest, 42)

Allow documentation examples with any function signature

#79808 · testing · medium impact · Accepted ·

Today an example function must take no arguments and return nothing. That makes it awkward to show code that returns an error or needs a *testing.T. This proposal lets example functions (Example or ExampleXxx, with the same naming rules as today) have any parameters and results.

func Example_returningAnError() error {
    f, err := os.Open("testfile")
    if err != nil {
        return err
    }
    defer f.Close()
    examplepackage.F(f)
    return nil
}

func TestExample_returningAnError(t *testing.T) {
    if err := Example_returningAnError(); err != nil {
        t.Fatal(err)
    }
}

Go doc shows such examples in the usual place, as the complete function including its doc comment. They are not runnable in the playground, and go test does not run them.

Add Same function to report whether two maps are identical

#78456 · maps · low impact · Accepted ·

Go maps are references to hash tables, but the language has no direct way to check whether two map values refer to the same table. Maps are not comparable with ==, and the workaround of comparing pointers via reflect is slow and awkward. Knowing that two maps alias is useful, for example to take a shortcut in a set union.

The new maps.Same function reports whether two maps refer to the same data structure. The two maps may have different named types, but they must share the same key and value types. The call compiles down to a single pointer comparison.

func union(x, y map[string]bool) map[string]bool {
    if maps.Same(x, y) {
        return x
    }
    z := maps.Clone(x)
    maps.Copy(z, y)
    return z
}

Set vcs.modified only when changes affect the build

#77897 · cmd/go · medium impact · Accepted ·

Today the go command marks a binary as modified (vcs.modified=true in build info, plus a +dirty suffix on the main module version) whenever the repository has any uncommitted change. Even a stray x.prof file or the binary left behind by go build triggers it. This makes go install non-idempotent: running go build and then go install installs a +dirty binary and deletes ./foo, and the next go install installs a clean one.

With this change, the go command sets vcs.modified=true only if the build inputs differ from those of a build in a clean checkout at the same revision. A modified, added, or deleted file counts only if it is part of the current build or would be part of the same build from the clean checkout. The second case catches changes that remove a file from the build without breaking it. Examples are deleting a dead-code file, deleting a file with only init side effects, deleting an embedded file, or adding //go:build ignore.

The goal is no false negatives: a binary is never reported as clean when it differs from a clean build.

Define a policy for deprecating and removing GODEBUG settings

#76163 · medium impact · Accepted ·

Go has accumulated many GODEBUG settings that let programs restore old behavior after compatibility-affecting changes (for example, panicnil=1). Each setting adds maintenance and testing burden. This proposal defines how such settings get deprecated and eventually removed.

Every new GODEBUG setting must either be marked permanent or get an earliest removal date at least two years (four releases) after it is introduced. To remove an existing setting that is permanent or has no removal date, someone must file a proposal. It must set a date at least two years after the setting was introduced and at least one release in the future, and it must address compatibility concerns. If the proposal is rejected, the setting becomes permanent.

In the release before the removal date, the setting is marked deprecated and the release notes announce its removal. If nobody raises strong objections in a flag-specific issue, the setting is removed in the next release and its default behavior becomes permanent. If there are objections, removal is postponed one release at a time, or the setting is made permanent.

Disallow the bare ... package pattern in module mode

#78387 · cmd/go · low impact · Accepted ·

In module mode, go list ... tries to list every package in every module in the build list. To do that, it must resolve dependencies that the build doesn't need. Those dependencies aren't requirements of the main module, so the command usually fails with a confusing error. It almost never does what users expect.

The go command will now return an error for the bare ... pattern in module mode. The error suggests ./... or work, which is usually what users want. Patterns that combine ... with other components, such as example.com/foo/..., still work because the extra components limit the search.

go list -m ... is not affected.

Add portable, vector-size agnostic simd package (experimental)

#78902 · simd · medium impact · Accepted ·

Go's existing SIMD support (simd/archsimd) is tied to a specific architecture and vector width, such as Float32x8 on amd64. This proposal adds a portable simd package under a GOEXPERIMENT. Its vector types have no fixed length: Int8s, Uint32s, Float64s, and so on, with masks Mask8s through Mask64s. At run time the package uses the largest vector size the CPU supports, such as AVX, AVX2, or AVX-512 on amd64, and reports it via VectorSize(). On architectures without SIMD support, it falls back to an emulation.

The initial API is the intersection of the amd64 and wasm SIMD APIs:

  • slice loads and stores;
  • arithmetic;
  • bitwise ops, shifts, min and max;
  • comparisons that return masks;
  • masking;
  • conversions.
func addScaled(dst, a, b []float32, k float32) {
    n := simd.LoadFloat32Slice(a).Len()
    // ... broadcast k into kv, loop in steps of n:
    x := simd.LoadFloat32Slice(a[i:])
    y := simd.LoadFloat32Slice(b[i:])
    x.MulAdd(kv, y).StoreSlice(dst[i:])
}

The compiler compiles SIMD-dependent code once per CPU variant and selects the right version at run time.

Allow QUIC to use a tls.Config with MinVersion below TLS 1.3

#77631 · crypto/tls · low impact · Accepted ·

QUIC requires TLS 1.3 (RFC 9001), so crypto/tls currently rejects a tls.Config used for QUIC unless MinVersion is VersionTLS13 or higher. This forces servers that share one config between TCP and QUIC to clone it. A dual-stack HTTP server is a common example: HTTP/2 accepts TLS 1.2+, while HTTP/3 needs TLS 1.3 only. Cloning adds overhead and has become harder after recent changes to Config.Clone.

The proposal removes the MinVersion check for QUIC. When a config is used for QUIC, crypto/tls internally raises the effective minimum to TLS 1.3. The Config value itself is left unchanged, so TCP connections still use the original setting. QUIC-only configs behave as before.

cfg := &tls.Config{
    MinVersion:   tls.VersionTLS12,
    Certificates: certs,
}
// The same cfg now works for both:
// TCP/HTTP/2 accepts TLS 1.2+, QUIC/HTTP/3 negotiates TLS 1.3 only.
conn := tls.QUICServer(&tls.QUICConfig{TLSConfig: cfg})

Add GoMod, Dir, and other module fields to analysis.Module

#73878 · x/tools/go/analysis · low impact · Accepted ·

The analysis.Module type, which analyzers see through Pass.Module, provides only Path and Version (plus GoVersion). Analyzers that need the module's files, such as a linter that reads go.mod and go.sum to check dependencies, have no way to find them.

The proposal adds all remaining fields from packages.Module to analysis.Module: Time, Dir, GoMod, etc. Drivers such as singlechecker, multichecker, unitchecker, go vet/go fix, and gopls fill in these fields.

func run(pass *analysis.Pass) (any, error) {
    if m := pass.Module; m != nil && m.GoMod != "" {
        sum := filepath.Join(filepath.Dir(m.GoMod), "go.sum")
        // read go.mod and go.sum ...
    }
    return nil, nil
}

Likely accept 4 proposals

In the final comment period: expected to be accepted unless new concerns come up.

Add named security profiles to tls.Config

#79043 · crypto/tls · medium impact · Likely accept ·

tls.Config has many separate knobs (cipher suites, versions, curves), and choosing them well is hard. Code that pins values today, such as CurvePreferences, also misses future improvements like post-quantum key exchange. Old algorithms are re-enabled through a growing list of separate GODEBUG settings.

The proposal adds a Profile field to tls.Config and introduces two named profiles in addition to the default one:

  • ProfileModern — stronger than the default, works with modern browsers and TLS stacks.
  • ProfileCompatibleButLessSecure — supports older peers, with weaker guarantees.
cfg := &tls.Config{
    Profile: tls.ProfileModern,
}

A profile controls all negotiated algorithms and X.509 certificate validation. An empty Profile keeps safe, broadly compatible defaults.

Profiles change over time to follow best practices. Their behavior follows the go version in the main module's go.mod. A single tls GODEBUG setting, such as GODEBUG=tls=go1.28, restores the behavior of up to four earlier versions.

The contents of each named profile will be decided in a separate proposal.

Add explicit query parsing and parsing limits

#82173 · net/http, mime/multipart · medium impact · Likely accept ·

Calling req.FormValue("key") to read a URL query parameter can silently parse the request body as a form. This can use up to 42MB of memory and unlimited disk space for multipart file uploads. The proposal makes query access explicit and lets servers limit or disable form parsing.

Handlers get explicit ways to read only the URL query, without touching the body, or to parse only urlencoded bodies. Each kind of parsing can take its own limits, and servers can set default limits for all requests. Servers can also turn off implicit multipart parsing, so that FormValue and PostFormValue never read uploaded files.

srv := &http.Server{
    DisableImplicitMultipartForm: true,
    MultipartFormLimits: multipart.FormLimits{
        MaxMemory:   1 << 20,
        MaxFileDisk: -1, // never write files to disk
    },
}

func handler(w http.ResponseWriter, r *http.Request) {
    id := r.QueryValue("id") // URL query only; body is not read
    _ = id
}

Limits cover memory, disk usage for uploaded files, and the number of parts and headers. Zero values keep today's defaults.

Graduate simd and simd/archsimd out of GOEXPERIMENT

#83009 · simd, simd/archsimd · medium impact · Likely accept ·

Go 1.26 added AMD64 SIMD intrinsics in simd/archsimd, and Go 1.27 added ARM64 NEON, WebAssembly, and a portable, vector-size-agnostic simd package (78902). All of these were available only under GOEXPERIMENT=simd. This proposal makes a large subset of both packages generally available on AMD64 (AVX, AVX2, AVX-512), ARM64 NEON, and WebAssembly, with a software fallback for simd on other platforms. It includes only operations covered by an executable pure-Go specification, which defines their exact semantics.

The portable simd package picks a vector size at startup based on the CPU, so callers never check CPU features. simd.VectorBits() and simd.Emulated() report the choice, and GODEBUG=simd=0 (emulate) or simd=128/256/512 (at most this size) overrides it. With archsimd, callers check features themselves, e.g. archsimd.X86.AVX2(), which compiles on every architecture. Calling an operation the CPU doesn't support may crash with an illegal instruction. Vectors and masks support == and !=, and ToArch/FromArch convert between the two packages.

// Portable: the vector width is chosen at startup.
var acc simd.Float32s
n := acc.Len()
for i := 0; i+n <= len(a); i += n {
    acc = acc.Add(simd.LoadFloat32s(a[i:]))
}
total := acc.ReduceSum()

// Architecture-specific: check the CPU feature first.
if archsimd.X86.AVX2() {
    x := archsimd.LoadFloat32x8(a)
    y := archsimd.LoadFloat32x8(b)
    x.Add(y).Store(dst)
}

The stable API moves to a new simdstable experiment that will be enabled by default, while new and deprecated APIs stay under GOEXPERIMENT=simd. For one release, GOEXPERIMENT=nosimdstable turns SIMD support off entirely. On WebAssembly, importing either package requires an engine with SIMD128. ARM64 SVE is not part of this proposal.

Check server certificates against a local UPKI revocation cache

#82402 · crypto/tls · low impact · Likely accept ·

Go's TLS client doesn't check whether server certificates have been revoked, especially on Linux and the BSDs, where Go verifies certificates itself. This proposal adds offline revocation checking to crypto/tls. It uses a local cache in the C2SP upki-revocation format, based on Mozilla's CRLite data as used in Firefox. A system service such as the rustls upki tool fills and updates the cache. Go only reads it: it does not download data or link to the tool.

The check is on by default for modules targeting Go 1.28 or later. It runs after normal chain and hostname verification, before VerifyPeerCertificate and VerifyConnection. It can only reject connections, never allow ones that would otherwise fail. Go looks for the cache in standard user and system locations, such as /var/cache/upki/revocation, and reopens the index on each check so updates apply without a restart.

A new Config.UPKIRevocation field lets clients disable the check, point it at a specific cache, or reject inconclusive results:

cfg := &tls.Config{
    UPKIRevocation: tls.UPKIRevocationConfig{
        Directory:   "/var/cache/upki/revocation",
        MissingData: tls.UPKIRevocationPolicyReject,
        NotCovered:  tls.UPKIRevocationPolicyReject,
        MissingSCTs: tls.UPKIRevocationPolicyAllow, // allow private PKI certificates
    },
}

Email digest

Weekly digest of accepted and implemented proposals, sent to the email group. Join the group (requires a Google account) or send an email to subscribe.