accessory icon indicating copy to clipboard operation
accessory copied to clipboard

Fix import issue for non-main packages

Open pistatium opened this issue 11 months ago • 2 comments

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!

pistatium avatar Jan 24 '25 01:01 pistatium

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!

masaushi avatar Jan 27 '25 04:01 masaushi

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!

pistatium avatar Jan 28 '25 07:01 pistatium