@@ -20,7 +20,7 @@ At Google, we developed a `context` package that makes it easy to pass request-scoped values, cancelation signals, and deadlines across API boundaries to all the goroutines involved in handling a request. The package is publicly available as -[[http://godoc.org/golang.org/x/net/context][golang.org/x/net/context]]. +[[https://golang.org/pkg/context][context]]. This article describes how to use the package and provides a complete working example. @@ -31,7 +31,7 @@ The core of the `context` package is the `Context` type: .code context/interface.go /A Context/,/^}/ (This description is condensed; the -[[http://godoc.org/golang.org/x/net/context][godoc]] is authoritative.) +[[https://golang.org/pkg/context][godoc]] is authoritative.) The `Done` method returns a channel that acts as a cancelation signal to functions running on behalf of the `Context`: when the channel is closed, the @@ -125,9 +125,10 @@ Client code uses the package path when importing the package. By convention, the last element of the package path is the package name: import ( - "fmt" // package fmt - "os/exec" // package exec - "golang.org/x/net/context" // package context + "context" // package context + "fmt" // package fmt + "golang.org/x/time/rate" // package rate + "os/exec" // package exec ) Build tools map package paths onto directories. |