Suppose I have a package within a package github.com/user/foo
:
foo/
main.go (package main)
bar/
bar.go (package bar)
Now, within bar.go
I would like to use an exported type from main.go
.
package main
type FooBar struct {}
If I try to import "github.com/user/foo"
I get cycled imports not allowed error. Is there any way to do this, other than to create own repo for bar
, which I don't want.