Skip to content
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

Generated import path contain "vendor" on Windows #203

Closed
welemon opened this issue Jun 27, 2018 · 4 comments
Closed

Generated import path contain "vendor" on Windows #203

welemon opened this issue Jun 27, 2018 · 4 comments
Labels

Comments

@welemon
Copy link

welemon commented Jun 27, 2018

latest mockery tool generated mock go file wrongly on Windows OS.
The import path shall contain "vendor" folder and cause test phase build error.
For example:
import bolt "github.com/welemon/vendor/github.com/boltdb/bolt"
lead to build error
mocks\db.go:4:8: must be imported as github.com/boltdb/bolt

This issue does not exist on Mac / Linux.
After quick check, I think the issue is because of "generator.go" line 180
directories := strings.Split(path, string(filepath.Separator))
The function is intended to remove the "vendor" and fix the import path.
But path var could already contains only slash ('/'), not backslack('\') on Windows.
Using filepath.Separator here will cause the path not tokenize correctly.
This also explain why only happen on Windows.

I tested with changing the filepath.Separator to slash, will fix the generated mock file.

Please fix this issue so that mockery can work on Windows properly? Thanks.

@LandonTClipp
Copy link
Collaborator

Hey, thanks for sending in the issue. Please submit a PR and we can get this merged.

@cretz
Copy link

cretz commented May 26, 2020

@LandonTClipp - Is this issue still valid? If so, can you leave it open so others that experience it can see it is a known issue instead of closing it asking for PR?

@LandonTClipp LandonTClipp reopened this May 26, 2020
@LandonTClipp
Copy link
Collaborator

LandonTClipp commented May 26, 2020

Yeah that's fine we can keep this open, sorry just trying to clear historic issues that may no longer be valid.

@LandonTClipp
Copy link
Collaborator

Hi, v1 is not supported anymore, closing this ticket. Please open a separate ticket if you still experience this issue. Thanks!

LandonTClipp pushed a commit to LandonTClipp/mockery that referenced this issue Oct 19, 2023
- Add benchmark test for registry.New
LandonTClipp pushed a commit to LandonTClipp/mockery that referenced this issue Nov 20, 2023
LandonTClipp pushed a commit to LandonTClipp/mockery that referenced this issue Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants