go.tools/cmd/vet: add a check for finalizers that reference their object
This check guards against an accidental direct reference to the object
being finalized in the finalizer, instead of using the finalizer's
argument.
This check, as implemented currently, checks only finalizers specified
as function literals.
Fixes issue 7546.
> And how many finalizers appear in that same corpus? 1152 > I think this ...
9 years, 9 months ago
(2014-06-19 20:15:14 UTC)
#9
> And how many finalizers appear in that same corpus?
1152
> I think this is a
> rare problem but one that's hard to diagnose and suitable for vet to
> catch.
SGTM. I was unsure how to interpret the data, which is why I didn't draw any
conclusions from it.
A few code nitpicks coming shortly...
https://codereview.appspot.com/97480043/diff/100001/cmd/vet/finalizers.go File cmd/vet/finalizers.go (right): https://codereview.appspot.com/97480043/diff/100001/cmd/vet/finalizers.go#newcode1 cmd/vet/finalizers.go:1: // Copyright 2013 The Go Authors. All rights reserved. ...
9 years, 9 months ago
(2014-06-19 20:17:08 UTC)
#10
https://codereview.appspot.com/97480043/diff/100001/cmd/vet/finalizers.go File cmd/vet/finalizers.go (right): https://codereview.appspot.com/97480043/diff/100001/cmd/vet/finalizers.go#newcode1 cmd/vet/finalizers.go:1: // Copyright 2013 The Go Authors. All rights reserved. ...
9 years, 9 months ago
(2014-06-19 21:38:49 UTC)
#11
https://codereview.appspot.com/97480043/diff/70003/cmd/vet/doc.go File cmd/vet/doc.go (right): https://codereview.appspot.com/97480043/diff/70003/cmd/vet/doc.go#newcode152 cmd/vet/doc.go:152: finalize. This causes the object to never be unreferenced ...
9 years, 9 months ago
(2014-06-19 22:29:02 UTC)
#15
https://codereview.appspot.com/97480043/diff/150001/cmd/vet/doc.go File cmd/vet/doc.go (right): https://codereview.appspot.com/97480043/diff/150001/cmd/vet/doc.go#newcode151 cmd/vet/doc.go:151: Finalizer functions that refer directly to the objects that ...
9 years, 9 months ago
(2014-06-19 22:35:39 UTC)
#16
R=close To the author of this CL: The Go project has moved to Gerrit Code ...
9 years, 3 months ago
(2014-12-19 05:19:28 UTC)
#19
R=close
To the author of this CL:
The Go project has moved to Gerrit Code Review.
If this CL should be continued, please see the latest version of
https://golang.org/doc/contribute.html for instructions on
how to set up Git and the Go project's Gerrit codereview plugin,
and then create a new change with your current code.
If there has been discussion on this CL, please give a link to it
(golang.org/cl/97480043 is best) in the description in your
new CL.
Thanks very much.
Issue 97480043: code review 97480043: go.tools/cmd/vet: add a check for finalizers that refer...
Created 9 years, 10 months ago by robryk
Modified 9 years, 3 months ago
Reviewers:
Base URL:
Comments: 19