equal
deleted
inserted
replaced
19 // |
19 // |
20 // Do not store Contexts inside a struct type; instead, pass a Context |
20 // Do not store Contexts inside a struct type; instead, pass a Context |
21 // explicitly to each function that needs it. The Context should be the first |
21 // explicitly to each function that needs it. The Context should be the first |
22 // parameter, typically named ctx: |
22 // parameter, typically named ctx: |
23 // |
23 // |
24 // func DoSomething(ctx context.Context, arg Arg) error { |
24 // func DoSomething(ctx context.Context, arg Arg) error { |
25 // // ... use ctx ... |
25 // // ... use ctx ... |
26 // } |
26 // } |
27 // |
27 // |
28 // Do not pass a nil Context, even if a function permits it. Pass context.TODO |
28 // Do not pass a nil Context, even if a function permits it. Pass context.TODO |
29 // if you are unsure about which Context to use. |
29 // if you are unsure about which Context to use. |
30 // |
30 // |
31 // Use context Values only for request-scoped data that transits processes and |
31 // Use context Values only for request-scoped data that transits processes and |