go - refer to interface in package from subdirectory of package -
There is a package with a sub-directory (sub-package) and not using the interface defined in the package from the sub-package can.
Therefore,
--- / F1 / File1: F1 is the package to create sub directory F2
Go ---
Type package f1 miner interface {Foo ()} function (m miner) {/ * blah * /} In F2, create a structure that should be part of the interface in F1:
--- / F1 / F2 / file /. ---
Type the package f2 My structure {i in a separate file, I try to use the package and create my composition and pass the function to the interface mine In the form: --- ./test_file.go ---
Package main import ("F1" "F1 / F2") m: = f2 mines {} F1 Function (& amp; m) This returns an error "f2.Mine interface does not apply to F1.Manir ... wants f1.Foo () but f2 fu ( )
Hopefully that makes sense. So, how do I create a straight in subdirectory F2 which uses the interface from F1?
Thanks ,
Definitely nothing is wrong in your package or directory: your f2. Mine does not apply to minor Only f2. My is a way Foo () . Take a look and
Comments
Post a Comment