]> Cypherpunks repositories - gostls13.git/commitdiff
context: replace newAfterFuncContext with a global declaration using blank identifier
authorJes Cok <xigua67damn@gmail.com>
Thu, 20 Feb 2025 15:10:06 +0000 (15:10 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 20 Feb 2025 16:16:29 +0000 (08:16 -0800)
newAfterFuncContext has never been used, the only reason I can imagine
for its existence is to guarantee that the implementation is correct.

It is a small cleanup and make code more idiomatic.

Change-Id: I61ee213a9284f3c3bda7f91196f3a1604babd0f6
GitHub-Last-Rev: c08bd69ef3f0dbc2f573f54095fea35dad2b1145
GitHub-Pull-Request: golang/go#71856
Reviewed-on: https://go-review.googlesource.com/c/go/+/651015
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/context/afterfunc_test.go

index 7b75295eb4dab03363efee1f56fbfa693edeca78..c2ef1062d3851fd055f27009bd1eb613d049619a 100644 (file)
@@ -20,9 +20,7 @@ type afterFuncContext struct {
        err        error
 }
 
-func newAfterFuncContext() context.Context {
-       return &afterFuncContext{}
-}
+var _ context.Context = (*afterFuncContext)(nil)
 
 func (c *afterFuncContext) Deadline() (time.Time, bool) {
        return time.Time{}, false