fix: [#749] The path is incorrect when publishing package files#1158
fix: [#749] The path is incorrect when publishing package files#1158
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request fixes an issue with incorrect paths when publishing package files in the vendor publish command. The primary fix involves removing unnecessary string manipulation that was causing path issues.
- Removed redundant string trimming logic that was incorrectly modifying target paths
- Enhanced test coverage with new error handling scenarios using mock contexts
- Cleaned up unused imports and code blocks
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| foundation/console/vendor_publish_command.go | Removed unused strings import and redundant string trimming logic |
| foundation/console/vendor_publish_command_test.go | Added new test cases with mocks for error scenarios |
| foundation/console/package_make_command_stubs.go | Removed unnecessary empty line |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Change the assertion in to |
The CIs of this PR passed, may it be optimized in another PR? |
I get what you mean, absolutely. |
|
@almas-x Good catch, there seem to be many errors in go v1.25 for us. I'll optimize goravel/.github, maybe create a new branch for go v1.24. |
📑 Description
Closes goravel/goravel#749
This pull request makes improvements to the vendor publish command and its tests, focusing on error handling and code cleanliness. The most important changes include enhanced test coverage for error cases, removal of unnecessary code, and simplification of logic in the vendor publish command.
Testing improvements:
VendorPublishCommandTestSuiteto verify error handling when no vendor is found and when the package directory does not exist, using mock contexts for more robust test coverage.Code simplification and cleanup:
stringsfromvendor_publish_command.go, as string manipulation is no longer required.Handlemethod ofVendorPublishCommandby removing redundant trimming of thetargetValuestring, which is no longer needed.mainfunction inpackage_make_command_stubs.goby removing an unused block of code.Test infrastructure updates:
mockandmocksconsoleto support new mocking in tests, improving the reliability and maintainability of the test suite.✅ Checks