3 ms·
Do that, then do a type alias in the package you would "like" for it to be imported from: mypkg/internal/foo/foo.go: type Foo struct { … } myp
by LukeShu 7y ago
Do that, then do a type alias in the package you would "like" for it to be imported from:
mypkg/internal/foo/foo.go:
type Foo struct { … }
mypkg/mypkg.go:
import "mypkg/internal/foo"
type Foo = foo.Foo
Then, it can be imported from "mypkg` and used as `mypkg.Foo`.
- frou_dh 7y agoNeat, you win at puzzle solving! I forget that the user-level type alias feature exists... maybe since it was introduced relatively late in the Go 1.x timeline.