aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/package-names.article6
1 files changed, 4 insertions, 2 deletions
diff --git a/content/package-names.article b/content/package-names.article
index 0f95a5b..4ecc057 100644
--- a/content/package-names.article
+++ b/content/package-names.article
@@ -84,8 +84,10 @@ Client code refers to this type as `http.Server`, so there is no ambiguity.
When a function in package pkg returns a value of type `pkg.Pkg` (or
`*pkg.Pkg`), the function name can often omit the type name without confusion:
- start := time.Now() // start is a time.Time
- t, err := time.Parse(time.Kitchen, "6:06PM") // t is a time.Time
+ start := time.Now() // start is a time.Time
+ t, err := time.Parse(time.Kitchen, "6:06PM") // t is a time.Time
+ ctx = context.WithTimeout(ctx, 10*time.Millisecond) // ctx is a context.Context
+ ip, ok := userip.FromContext(ctx) // ip is a net.IP
A function named `New` in package `pkg` returns a value of type `pkg.Pkg`.
This is a standard entry point for client code using that type: