-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails to generate files in an empty directory #35
Comments
Just pulled my hair out for a few minutes before i realized what was going on. If the file that is being generated is the first file in the directory, it appears that dataloaden does not know what to put in the package declaration at the top of the file, so it outputs an empty string (assuming, haven't looked at the code). gofmt is then ran to sort the imports and the compiler complains because the package name is empty and everything is reverted To fix this, I simply created an empty file in the directory and put a package declaration in it. gen.go
Delete the file afterwards and all subsequent dataloaden generations should be fine. |
Here is an example of a file generated without running gofmt process dataloaden/pkg/generator/generator.go Line 147 in 9d6b85c
Notice the package declaration at the top of the file is empty. And here is the error when running gofmt myself from the cli
I am not 100% sure how to fix this....best of luck to anybody else that ends up here from Google To bypass I simply commented out the import.Process and just passed in the
Now you can go through all of that to generate the file or use the method I outlines in my last comment and you will be perfectly fine till this gets fixed. |
This is almost the same issue reported in #30.
dataloaden retrieves a package name in the current working directory when generating a file.
But, if no packages are found in the working directory, the generated file has no (empty) package name and is broken.
I got the error below (same as #30) when I tried to generate in a newly created directory.
The text was updated successfully, but these errors were encountered: