Merge lp://staging/~dave-cheney/juju-core/110-fix-lp-1251076 into lp://staging/~go-bot/juju-core/trunk
Status: | Merged |
---|---|
Approved by: | Dave Cheney |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2550 |
Proposed branch: | lp://staging/~dave-cheney/juju-core/110-fix-lp-1251076 |
Merge into: | lp://staging/~go-bot/juju-core/trunk |
Diff against target: |
18 lines (+7/-1) 1 file modified
rpc/rpcreflect/type.go (+7/-1) |
To merge this branch: | bzr merge lp://staging/~dave-cheney/juju-core/110-fix-lp-1251076 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+213764@code.staging.launchpad.net |
Commit message
Workaround LP 1251076
gccgo appears to get confused and thinks that out[1] is not nil when in fact it is an interface value of type error and value nil.
This workaround solves the problem by leaving error as nil if in fact it was nil and causes no harm for gc because the predicates above assert that if out[1] is not nil, then it is an error type.
Description of the change
Workaround LP 1251076
gccgo appears to get confused and thinks that out[1] is not nil when in fact it is an interface value of type error and value nil.
This workaround solves the problem by leaving error as nil if in fact it was nil and causes no harm for gc because the predicates above assert that if out[1] is not nil, then it is an error type.
Reviewers: mp+213764_ code.launchpad. net,
Message:
Please take a look.
Description:
Workaround LP 1251076
gccgo appears to get confused and things that out[1] is not nil when in
fact it is an interface value of type error and value nil.
This workaround solves the problem by leaving error as nil if in fact it
was nil and causes no harm for gc because the predicates above assert
that if out[1] is not nil, then it is an error type.
https:/ /code.launchpad .net/~dave- cheney/ juju-core/ 110-fix- lp-1251076/ +merge/ 213764
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/83340045/
Affected files (+9, -1 lines): type.go
A [revision details]
M rpc/rpcreflect/
Index: [revision details] 20140402024520- p4uc9yiaf00lnjc y
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: rpc/rpcreflect/ type.go /type.go' type.go 2013-09-24 07:12:05 +0000 type.go 2014-04-02 04:55:38 +0000 m.Index) .Call([ ]reflect. Value{reflect. ValueOf( id)}) Interface( ).(error) Interface( ).(error)
=== modified file 'rpc/rpcreflect
--- rpc/rpcreflect/
+++ rpc/rpcreflect/
@@ -144,7 +144,13 @@
f := func(rcvr reflect.Value, id string) (r reflect.Value, err error) {
out := rcvr.Method(
if !out[1].IsNil() {
- err = out[1].
+ // Workaround LP 1251076.
+ // gccgo appears to get confused and things that out[1] is not nil when
+ // in fact it is an interface value of type error and value nil.
+ // This workaround solves the problem by leaving error as nil if in fact
+ // it was nil and causes no harm for gc because the predicates above
+ // assert that if out[1] is not nil, then it is an error type.
+ err, _ = out[1].
}
r = out[0]
return