Hello, On Mon, 2020-03-02 at 02:39 +0100, Andreas Henriksson wrote: > Hello, > > On Sun, Feb 23, 2020 at 02:08:07PM +0100, Lucas Nussbaum wrote: > > Source: golang-github-mendersoftware-scopestack > > Version: 0.0~git20180403.c2f5599-2 > [...] > > > === RUN TestPushPopNotInSameFunction > > > --- FAIL: TestPushPopNotInSameFunction (0.00s) > > > scope_stack_test.go:57: Should never get here > > > scope_stack_test.go:52: Pop() should have panicked when used > > > in a different function than Push() > > > === RUN TestDifferentScopeDistance > > > --- FAIL: TestDifferentScopeDistance (0.00s) > > > scope_stack_test.go:95: Should never get here > > > scope_stack_test.go:89: Should have panicked because scope > > > stack distance should point to this function > [...] > > I assume the problem is caused by newer golang. It appears that > atleast > nowadays (with go1.13.8) an inlined (anonymous) function will have > the same Func(tion) Entry(point) as the parent function it was > inlined > into, eg. as used in the TestPushPopNotInSameFunction testcase. > > The two Func(tions) however will have different Name()s, so simply > adding those to the Entry() comparisons will make the test-suite pass > again. See attached patch. > > I'm not quite sure if this is the most robust fix, so would be great > to > have some feedback from upstream (hopefully via Lluis in CC).
The patch looks good to us. Thanks Andreas for following up! Side note. We have discussed internally and decided that we will remove both scopestack and log[1] dependencies from the mender-client code. This will ease maintenance of the Debian package :) [1] https://tracker.debian.org/pkg/golang-github-mendersoftware-log -- LluĂs | mender.io > > Some semi-relevant discussion is available at: > https://github.com/golang/go/issues/29582 > ... where it's discussed that rather than runtime.Caller and > FuncForPC > it's better to use runtime.Callers and runtime.CallersFrames which is > supposed to deal properly with inlining, whatever that means. > > Regards, > Andreas Henriksson