Fix import issue for non-main packages
Description: This PR addresses the issue where the generated code for non-main packages does not correctly import the required time package, leading to a build failure. Additionally, a test case using the time package has been added to ensure proper generation and functionality.
Changes: • Fixed import handling for non-main packages in the generated code. • Added a test case that utilizes the time package to verify correct behavior.
Related Issue: • Fixes #95
Please review the changes, and let me know if any modifications are needed. Thank you for your time!
Thank you for your contribution! Your changes look good, but you probably don’t need to add a new test case since there’s already a test that checks the import of the time package:
https://github.com/masaushi/accessory/blob/396cae59b4fc8880c1ab05010f927ef3ce1e2ab7/cmd/testdata/import_packages/tester.go#L13
Once again, I appreciate your effort in fixing this issue. Thank you!
Thank you for your review and for pointing that out.
I overlooked the existing test case. It indeed appears to be working correctly, and I was unable to write a test case that reliably reproduces the issue on my end.
Since I cannot be entirely sure that my changes fully resolve the problem, I will take some time to investigate further.
I appreciate your patience and guidance!