Skip to content

proposal: context/v2: update context package #28342

Open
@ianlancetaylor

Description

@ianlancetaylor

This issue is intended to cover ideas about updating the context package for Go 2.

  • The current context package leads to stuttering in declarations: ctx context.Context.
  • The current Context.WithValue function accepts values of any types, which is easy to misuse by passing, say, a string rather than a value of some package-local type.
  • The name Context is confusing to some people, since the main use of contexts is cancelation of goroutines.
  • Context values are passed everywhere explicitly, which troubles some people. Some explicitness is clearly good, but can we make it simpler?

See also #24050 and #20280.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Proposalv2An incompatible library change

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions