steverusso/goclap

Can this work outside `main` package?

Closed this issue · 2 comments

@steverusso I started making a Go Example test here, but goclap doesn't seem to generate the right code if it's outside the main package.

Is this something it could support? I think having testable example would be beneficial for the project!

This raises two good points:

  1. goclap as it stands will panic when used on any package other than main since I naively hardcoded the package name.
  2. I think tests would be beneficial, and testable examples probably can't hurt. I'll investigate that branch a little further and start making whichever few adjustments are necessary here.

With 4c3916f, it won't panic for a package other than main ✔️