You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Code generated by http://github.com/gojuno/minimock (v3.3.13). DO NOT EDIT.package mocks
import (
"sync"
mm_atomic "sync/atomic"
mm_time "time""path/to/bar""github.com/gojuno/minimock/v3"
)
// FooMock implements foo.FootypeFooMockstruct {
t minimock.TesterfinishOnce sync.OncefuncDoFoofunc() (p1 bar.Bar[Baz])
inspectFuncDoFoofunc()
afterDoFooCounteruint64beforeDoFooCounteruint64DoFooMockmFooMockDoFoo
}
...
Here, the Baz reference in func() (p1 bar.Bar[Baz]) fails because the file is generated inside package mocks - it needs to import /path/to/foo and reference it as foo.Baz.
Also
It works when not using generics
If the Foo interface doesn't use generics, then it works, even when placing mocks in a different package:
Setup
Using this file structure:
where
bar/bar.go:
and
foo.go:
Works
The following generates correctly:
gen.go:
mocks/foo_mock_test.go:
Here, the
Baz
reference infunc() (p1 bar.Bar[Baz])
succeeds because the file is generated inside packagefoo
.Doesn't work
However, placing the output in a different package fails:
gen.go:
mocks/foo_mock_test.go:
Here, the
Baz
reference infunc() (p1 bar.Bar[Baz])
fails because the file is generated inside packagemocks
- it needs to import/path/to/foo
and reference it asfoo.Baz
.Also
It works when not using generics
If the
Foo
interface doesn't use generics, then it works, even when placing mocks in a different package:foo.go:
gen.go:
mocks/foo_mock_test.go:
It doesn't work even if the generic type is in the same package as the interface being mocked
foo.go:
gen.go:
mocks/foo_mock_test.go:
Here, both
Bar
andBaz
are referenced incorrectly.The text was updated successfully, but these errors were encountered: