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
Currently if you want to generate an interface file and have it reside in the same package as things the interface might depend on then you end up with generated code that fails to compile because the code is trying to import itself.
For instance, you have a package called car and you have defined a type car.Tire in the car package. You also have a service implementation file like car.Car and you have a method like ChangeTire(tire Tire). You now want to create an interface file in the same package car and call this interface file intf.go. If you try to generate the interface for car.Car you will have an extra import to the car package and your interface will have the method ChangeTire(tire car.Tire). This will fail to compile.
I expect the interface file to not have the extra import and the method should be ChangeTire(tire Tire).
The text was updated successfully, but these errors were encountered:
stgraham2000
pushed a commit
to Ioka-Technologies/interfaces
that referenced
this issue
Sep 23, 2023
…ge as impl
Modify generator to detect if the dependency matches the new interface's
package name and if so, skip adding the dependency (so skip import).
Also, when generating the parameter package names, if the package matches
the new interface's package then make the package blank.
stgraham2000
pushed a commit
to Ioka-Technologies/interfaces
that referenced
this issue
Sep 23, 2023
…ge as impl
Modify generator to detect if the dependency matches the new interface's
package name and if so, skip adding the dependency (so skip import).
Also, when generating the parameter package names, if the package matches
the new interface's package then make the package blank.
stgraham2000
added a commit
to Ioka-Technologies/interfaces
that referenced
this issue
Sep 23, 2023
Currently if you want to generate an interface file and have it reside in the same package as things the interface might depend on then you end up with generated code that fails to compile because the code is trying to import itself.
For instance, you have a package called
car
and you have defined a typecar.Tire
in thecar
package. You also have a service implementation file likecar.Car
and you have a method likeChangeTire(tire Tire)
. You now want to create an interface file in the same packagecar
and call this interface fileintf.go
. If you try to generate the interface forcar.Car
you will have an extra import to thecar
package and your interface will have the methodChangeTire(tire car.Tire)
. This will fail to compile.I expect the interface file to not have the extra import and the method should be
ChangeTire(tire Tire)
.The text was updated successfully, but these errors were encountered: