Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(179)

Issue 11858043: code review 11858043: runtime: allow SetFinalizer with a func(interface{}) (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 11 months ago by peted
Modified:
11 years, 9 months ago
CC:
golang-dev, dvyukov
Visibility:
Public.

Description

runtime: allow SetFinalizer with a func(interface{}) Fixes issue 5368.

Patch Set 1 #

Patch Set 2 : diff -r b9ee7a3df1c9 https://code.google.com/p/go #

Patch Set 3 : diff -r b9ee7a3df1c9 https://code.google.com/p/go #

Total comments: 30

Patch Set 4 : diff -r ac410fc1fe6c https://code.google.com/p/go #

Patch Set 5 : diff -r ac410fc1fe6c https://code.google.com/p/go #

Patch Set 6 : diff -r ac410fc1fe6c https://code.google.com/p/go #

Patch Set 7 : diff -r ac410fc1fe6c https://code.google.com/p/go #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+126 lines, -16 lines) Patch
M src/pkg/runtime/extern.go View 1 1 chunk +3 lines, -2 lines 0 comments Download
M src/pkg/runtime/malloc.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/runtime/malloc.goc View 1 2 3 3 chunks +11 lines, -3 lines 0 comments Download
M src/pkg/runtime/mfinal.c View 1 9 chunks +9 lines, -5 lines 0 comments Download
M src/pkg/runtime/mfinal_test.go View 1 2 3 4 5 1 chunk +86 lines, -0 lines 2 comments Download
M src/pkg/runtime/mgc0.c View 1 2 3 6 chunks +15 lines, -4 lines 0 comments Download
M src/pkg/runtime/runtime.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 15
peted
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com, rsc@golang.org), I'd like you to review this change to https://code.google.com/p/go
11 years, 11 months ago (2013-07-25 19:47:08 UTC) #1
dvyukov
https://codereview.appspot.com/11858043/diff/5001/src/pkg/runtime/malloc.goc File src/pkg/runtime/malloc.goc (right): https://codereview.appspot.com/11858043/diff/5001/src/pkg/runtime/malloc.goc#newcode851 src/pkg/runtime/malloc.goc:851: uintptr nret = 0; do not initialize variable during ...
11 years, 11 months ago (2013-07-26 09:55:04 UTC) #2
peted
All done except src/pkg/runtime/mfinal_test.go:29. What do you propose? https://codereview.appspot.com/11858043/diff/5001/src/pkg/runtime/malloc.goc File src/pkg/runtime/malloc.goc (right): https://codereview.appspot.com/11858043/diff/5001/src/pkg/runtime/malloc.goc#newcode851 src/pkg/runtime/malloc.goc:851: uintptr ...
11 years, 11 months ago (2013-07-26 23:31:24 UTC) #3
peted
Hello golang-dev@googlegroups.com, dvyukov@google.com (cc: golang-dev@googlegroups.com, rsc@golang.org), Please take another look.
11 years, 11 months ago (2013-07-26 23:33:40 UTC) #4
dvyukov
On Sat, Jul 27, 2013 at 3:31 AM, <pieter@binky.org.uk> wrote: > All done except src/pkg/runtime/mfinal_test.go:29. ...
11 years, 11 months ago (2013-07-27 10:06:35 UTC) #5
peted
On 2013/07/27 10:06:35, dvyukov wrote: > On Sat, Jul 27, 2013 at 3:31 AM, <mailto:pieter@binky.org.uk> ...
11 years, 11 months ago (2013-07-27 10:16:48 UTC) #6
dvyukov
On 2013/07/27 10:16:48, peted wrote: > On 2013/07/27 10:06:35, dvyukov wrote: > > On Sat, ...
11 years, 11 months ago (2013-07-27 10:18:52 UTC) #7
peted
Hello golang-dev@googlegroups.com, dvyukov@google.com (cc: golang-dev@googlegroups.com, rsc@golang.org), Please take another look.
11 years, 11 months ago (2013-07-27 10:20:34 UTC) #8
dvyukov
*** Submitted as https://code.google.com/p/go/source/detail?r=253cf8517c5d *** runtime: allow SetFinalizer with a func(interface{}) Fixes issue 5368. R=golang-dev, ...
11 years, 11 months ago (2013-07-29 15:43:51 UTC) #9
rsc
I would have liked to have been given a chance to look at this before ...
11 years, 11 months ago (2013-07-29 17:16:01 UTC) #10
dvyukov
On Mon, Jul 29, 2013 at 9:16 PM, <rsc@golang.org> wrote: > I would have liked ...
11 years, 11 months ago (2013-07-29 17:29:49 UTC) #11
peted
On 2013/07/29 17:29:49, dvyukov wrote: > On Mon, Jul 29, 2013 at 9:16 PM, <mailto:rsc@golang.org> ...
11 years, 11 months ago (2013-07-29 20:12:03 UTC) #12
rsc
I'll think about it and figure out whether I want to change anything. Thanks.
11 years, 11 months ago (2013-07-30 23:28:27 UTC) #13
rsc
CL https://codereview.appspot.com/12895043 expands this.
11 years, 10 months ago (2013-08-13 21:30:45 UTC) #14
fresh.grass.yum
11 years, 9 months ago (2013-09-19 23:18:40 UTC) #15
Message was sent while issue was closed.
https://codereview.appspot.com/11858043/diff/31001/src/pkg/runtime/mfinal_tes...
File src/pkg/runtime/mfinal_test.go (right):

https://codereview.appspot.com/11858043/diff/31001/src/pkg/runtime/mfinal_tes...
src/pkg/runtime/mfinal_test.go:83: t.Errorf("Expected *bigValue from interface{}
in finalizer, got %v", *i)
If I read this correctly the type "*bigValue" was expected. If that is the case
the printf verb "%v" should probably be replaced with "%T" and "*i" with "i"?

t.Errorf("Expected *bigValue from interface{} in finalizer, got %T", i)

https://codereview.appspot.com/11858043/diff/31001/src/pkg/runtime/mfinal_tes...
src/pkg/runtime/mfinal_test.go:85: if i.fill != 0xDEADBEEFDEADBEEF && i.it !=
true && i.up != "It matters not how strait the gate" {
Currently the test will only fail if all values are incorrect. What if one is
incorrect? Either "||" should be used instead of "&&" but I would rather want to
split the test into three different ones to give better error reporting.

Currently "%d" is an invalid printf verb for "*i".

What is the expected output if this fails?

Suggested replacement:
if i.fill != 0xDEADBEEFDEADBEEF {
	t.Errorf("Expected %d, got %d.", 0xDEADBEEFDEADBEEF, i.fill)
}
if i.it != true {
	t.Errorf("Expected %t, got %t.", true, i.it)
}
if i.up != "It matters not how strait the gate" {
	t.Errorf("Expected %q, got %q.", "It matters not how strait the gate", i.up)
}

If these tests are rewritten in the future it would be nice to make them table
driven instead, this would reduce duplicate entries of strings such as: "It
matters not how strait the gate" (which can lead to typos).
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b