It is not possible to import main packages in general, although it does seem to be possible to import a main package from external tests in the same directory.
tst.go: 9:3: import "local/cmd/test" is a program, not an importable package I'm not why this restriction exists. On 13 Dec 2016 17:17, "Jan Mercl" <[email protected]> wrote: > On Tue, Dec 13, 2016 at 6:13 PM adonovan via golang-nuts < > [email protected]> wrote: > > > Packages named main are importable, just like any other. Occasionally > this is useful when you want to write tests for members of that package. Of > course, the main function is not exported. > > I recall running into this limitation years ago. Was it always possible? > Or do I have a false remembrance? > > -- > > -j > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
