If a directory is passed to the command line tool, the directory
includes test files, and those test files specify types that the tool is
interested in (e.g. struct types) then it will trigger a compiler error,
fail to generate, and leave some detritus in the target directory.
We should filter out test files from consideration to prevent this error
from occuring. Future development could include a command line option to
process test files, if anyone wants that (unlikely).
Since doc's can be added on both the generic declaration (GenDecl) as well as on the type declaration (TypeSpec) we need to check both.
In order to check both declaration we copy the GenDecl docs to the TypeSpec docs if the TypeSpec has no documentation.
It is no longer required to have the GOPATH environment variable set -
it now defaults to ~/go, but irrespective of whether the value is the
default or not it can be found in the standard output of `go env
GOPATH`.
This commit uses that value if the GOPATH environment variable is not
set.