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

Best effort guesses for output package path #547

Merged
merged 2 commits into from Apr 16, 2021

Conversation

linzhp
Copy link
Contributor

@linzhp linzhp commented Mar 27, 2021

I know we need output package path to avoid self-importing. However, this only happens when the mock is output into an already existing package, in which case the caller is responsible for passing -self_package. Without -self_package, guessing output package path should be on best effort basis. There is no requirement for destination to be in a Go module or GOPATH (in fact, it's hard, if possible at all, to do so in Bazel). So parsePackageImport(dstPath) often fails. Such failure should not fail the main program. We should instead be optimistic and leave output package package empty, assuming no self importing would happen.

@linzhp linzhp requested a review from codyoss as a code owner March 27, 2021 01:15
@codyoss
Copy link
Member

codyoss commented Apr 16, 2021

This seems reasonable to me, thanks for the contribution!

@codyoss codyoss merged commit 317c030 into golang:master Apr 16, 2021
@linzhp linzhp deleted the optional_package branch July 4, 2021 00:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants