Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Reflect in Current Directory First #390

Merged
merged 1 commit into from
Feb 3, 2020
Merged

Conversation

minicuts
Copy link
Contributor

@minicuts minicuts commented Jan 22, 2020

Fixes #354

Description
Reflect in Current Directory First

Some users have intention to run mockgen in a module aware directory with
version pinned to those in go.mod.

Always try to run reflect program in current working directory first.

More context about the root cause of the bug is in #354 (comment)

Submitter Checklist

  • Includes tests

Reviewer Notes

  • The code flow looks good.
  • Tests added.

Release Notes

Some users have intention to run mockgen in a module aware directory with
version pinned to those in `go.mod`.

Always try to run reflect program in current working directory first.
@cvgw
Copy link
Collaborator

cvgw commented Jan 23, 2020

So previously this code tried to execute reflect in

  1. The root directory of the pkg in question
  2. The current directory that mockgen was execute from
  3. The tmp directory

This change would make it

  1. The current directory that mockgen was execute from
  2. The root directory of the pkg in question
  3. The tmp directory

Is that correct?

@minicuts
Copy link
Contributor Author

@cvgw exactly. To be more precise the execution in pkg happenes only with module support. Without module support mockgen would try to first execute in GOPATH.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
2 participants