-
Notifications
You must be signed in to change notification settings - Fork 607
Source mode fails with embedded interfaces in a specific case #85
Comments
This also works in the following scenario: github.com/anyuser/pkg1/file1.go
github.com/anyuser/pkg1/file2.go
Just to make explicit the difference here: Two separate files, but same package produces the same issue.
The above produces the 'unknown embedded interface' error. It can also be resolved as you described, by the following:
But again, thats invalid Golang code. |
Looking into it more, I found this TODO in the source code. Line 18 in 747e9e6
|
Both given examples above work now. |
@balshetzer Just checked. Not working. The only way to solve this case is to use reflect mode. |
As I said in #178, The aux_files flag needs to specify the full package path. |
Test adding a new cluster and leader election Test leader election when elected leader becomes disconnected TODO: test removing a cluster NOTE: Used pegomock to generate a mock for RemoteCluster so that we can verify StartMonitoring is invoked. TODO: Use mockgen instead but for now couldnt get it working due to RemoteCluster embedding CommonArea interface (Ref:golang/mock#85) Also had to edit the mock file generated by pegomock due to go test complaining of a race in mock code. Added a mutex lock in the mock code although ideally we should not edit generated mock files
RemoteCluster Tests ------------------- Test that member announce is written and connectivity is set to true. TODO: Find out if fakeClient can error writes so we can test disconnection case NOTE: used mockgen to generate mocks for Manager from controller-runtime library and for RemoteClusterManager. TODO: Add mockgen to Makefile so it always gets generated automatically. RemoteClusterManager and LeaderElector tests -------------------------------------------- Test adding a new cluster and leader election Test leader election when elected leader becomes disconnected TODO: test removing a cluster NOTE: Used pegomock to generate a mock for RemoteCluster so that we can verify StartMonitoring is invoked. TODO: Use mockgen instead but for now couldnt get it working due to RemoteCluster embedding CommonArea interface (Ref:golang/mock#85) Also had to edit the mock file generated by pegomock due to go test complaining of a race in mock code. Added a mutex lock in the mock code although ideally we should not edit generated mock files
RemoteCluster Tests ------------------- Test that member announce is written and connectivity is set to true. TODO: Find out if fakeClient can error writes so we can test disconnection case NOTE: used mockgen to generate mocks for Manager from controller-runtime library and for RemoteClusterManager. TODO: Add mockgen to Makefile so it always gets generated automatically. RemoteClusterManager and LeaderElector tests -------------------------------------------- Test adding a new cluster and leader election Test leader election when elected leader becomes disconnected TODO: test removing a cluster NOTE: Used pegomock to generate a mock for RemoteCluster so that we can verify StartMonitoring is invoked. TODO: Use mockgen instead but for now couldnt get it working due to RemoteCluster embedding CommonArea interface (Ref:golang/mock#85) Also had to edit the mock file generated by pegomock due to go test complaining of a race in mock code. Added a mutex lock in the mock code although ideally we should not edit generated mock files Signed-off-by: Aravinda Kidambi <[email protected]>
RemoteCluster Tests ------------------- Test that member announce is written and connectivity is set to true. TODO: Find out if fakeClient can error writes so we can test disconnection case NOTE: used mockgen to generate mocks for Manager from controller-runtime library and for RemoteClusterManager. TODO: Add mockgen to Makefile so it always gets generated automatically. RemoteClusterManager and LeaderElector tests -------------------------------------------- Test adding a new cluster and leader election Test leader election when elected leader becomes disconnected TODO: test removing a cluster NOTE: Used pegomock to generate a mock for RemoteCluster so that we can verify StartMonitoring is invoked. TODO: Use mockgen instead but for now couldnt get it working due to RemoteCluster embedding CommonArea interface (Ref:golang/mock#85) Also had to edit the mock file generated by pegomock due to go test complaining of a race in mock code. Added a mutex lock in the mock code although ideally we should not edit generated mock files Signed-off-by: Aravinda Kidambi <[email protected]>
Here are my test files (2 packages):
github.com/anyuser/pkg1/pkg1.go:
github.com/anyuser/pkg2/pkg2.go:
If you run
go generate
onpkg2
then you get the following error message:Note that mock generation succeeds if you go to
pkg1
and embed theE
interface intoI
by prefixing it with the package namepkg1.E
but that turnspkg1.go
into invalid go code that doesn't compile.The text was updated successfully, but these errors were encountered: