Hi everyone, I am pretty new to golang and I have the following question. I developed a lib for internal use here at work. It has it's own package and tests inside the git repo. Now, I would like to add an example of how to use it, but if I add a package main file it will be interpreted as a command and installed whenever someone does a go install (which is not good, I guess).
An approach I saw in various projects is to include a non test function in a test file just to show how the lib should be used. Examples: - https://github.com/sirupsen/logrus/blob/master/example_hook_test.go - https://github.com/juju/errors/blob/master/example_test.go Is this the right approach? In this way the example functions are not included in the release (since they belong to tests) and do not interfere with tests (since the name / args do not fit), but how am I supposed to try them inside a main? Thanks in advance, Federico -- 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.
