Closed watchforstock closed 8 years ago
Upon further investigation, it looks like this was largely down to a GOPATH issue meaning it couldn't find the libraries when running the imports.Process
function.
watchforstock - what was your diagnostic process like here? I'm seeing similar behavor where some imports are being dropped. In my case they're all in my repo so inability to find the libraries seems unlikely.
For future readers: imports seem to be completely managed by a call to imports.Process
-- the genny
processing doesn't even read them in deferring entirely to imports.Process
to consume the template and produce a sorted/culled list of imports.
edit: actually -- backing off -- genny seems to pass the contents of the template into Process
's src
parameter so without digging into imports
pkg I'm not sure where it's getting the potential imports at all.
It appears than non-built-in import statements are being lost on generation. As an example, take a "simpletest.go" file that looks like this:
if I then run the command
cat simpletest.go | genny gen "MyType=ConcreteType" > simpletest_gen.go
I get the following output:You can see the import statement has correctly dropped the genny reference, but also incorrectly removed the mux reference which means the code is now invalid.
Am I doing something wrong?