Skip to content

fix: [#749] The path is incorrect when publishing package files#1158

Merged
hwbrzzl merged 1 commit intomasterfrom
bowen/#749-1
Aug 17, 2025
Merged

fix: [#749] The path is incorrect when publishing package files#1158
hwbrzzl merged 1 commit intomasterfrom
bowen/#749-1

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Aug 16, 2025

📑 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:

  • Added new tests to VendorPublishCommandTestSuite to 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:

  • Removed the unnecessary import of strings from vendor_publish_command.go, as string manipulation is no longer required.
  • Simplified the logic in the Handle method of VendorPublishCommand by removing redundant trimming of the targetValue string, which is no longer needed.
  • Cleaned up the main function in package_make_command_stubs.go by removing an unused block of code.

Test infrastructure updates:

  • Added imports for mock and mocksconsole to support new mocking in tests, improving the reliability and maintainability of the test suite.

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings August 16, 2025 11:01
@hwbrzzl hwbrzzl requested a review from a team as a code owner August 16, 2025 11:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@almas-x
Copy link
Contributor

almas-x commented Aug 17, 2025

Change the assertion in

s.Contains(captureOutput, `go: github.com/goravel/package@unknown: invalid version: git ls-remote -q origin in`)

to "go: github.com/goravel/package@unknown: invalid version" to fix the CI failure. This is because Go 1.25 has optimized the error message for go get.

@hwbrzzl
Copy link
Contributor Author

hwbrzzl commented Aug 17, 2025

Change the assertion in

s.Contains(captureOutput, `go: github.com/goravel/package@unknown: invalid version: git ls-remote -q origin in`)

to "go: github.com/goravel/package@unknown: invalid version" to fix the CI failure. This is because Go 1.25 has optimized the error message for go get.

The CIs of this PR passed, may it be optimized in another PR?

@almas-x
Copy link
Contributor

almas-x commented Aug 17, 2025

Change the assertion in

s.Contains(captureOutput, `go: github.com/goravel/package@unknown: invalid version: git ls-remote -q origin in`)

to "go: github.com/goravel/package@unknown: invalid version" to fix the CI failure. This is because Go 1.25 has optimized the error message for go get.

The CIs of this PR passed, may it be optimized in another PR?

I get what you mean, absolutely.

@hwbrzzl
Copy link
Contributor Author

hwbrzzl commented Aug 17, 2025

@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.

@hwbrzzl hwbrzzl merged commit 8695c99 into master Aug 17, 2025
11 of 12 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#749-1 branch August 17, 2025 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The path is incorrect when publishing package files

3 participants