Skip to content

Support for archive mode#125

Open
sywhang wants to merge 8 commits into
mainfrom
archive
Open

Support for archive mode#125
sywhang wants to merge 8 commits into
mainfrom
archive

Conversation

@sywhang

@sywhang sywhang commented Nov 21, 2023

Copy link
Copy Markdown
Contributor

This adds support for a 3rd option for creating mocks after reflect and source-mode: the archive mode. Archive mode lets you load archive files to create mocks. This can come in handy for writing Bazel rules that produce intermediary archive files and automatically codegen mocks in Bazel environments.

@sywhang sywhang requested review from JacobOaks and r-hang November 23, 2023 08:44

@r-hang r-hang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Logic looks good to me.

Given the amount of code added in the form of InterfaceFromGoTypesType do you think it makes sense to add some type of test that reads from a checked in archive?

@JacobOaks JacobOaks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a couple comments. I also agree with @r-hang that we should probably add some tests.

Comment thread README.md Outdated
Comment thread mockgen/archive.go Outdated
Comment thread mockgen/model/model_gotypes.go Outdated
Comment thread mockgen/model/model_gotypes.go Outdated
Comment thread mockgen/model/model_gotypes.go Outdated
Comment thread mockgen/model/model_gotypes.go Outdated
Comment thread mockgen/model/model_gotypes.go Outdated
@sywhang

sywhang commented Dec 5, 2023

Copy link
Copy Markdown
Contributor Author

Given the amount of code added in the form of InterfaceFromGoTypesType do you think it makes sense to add some type of test that reads from a checked in archive?

Yes, that's a good suggestion. Will make that change.

sywhang added a commit that referenced this pull request Jun 12, 2025
This adds support for a 3rd option for creating mocks after reflect and
source-mode: the archive mode. Archive mode lets you load archive files
to create mocks. This can come in handy for writing Bazel rules that
produce intermediary archive files and automatically codegen mocks in
Bazel environments.

Rebased version of #125

---------

Co-authored-by: Zhongpeng Lin <zplin@uber.com>
Co-authored-by: Sung Yoon Whang <sungyoonwhang@gmail.com>
Co-authored-by: Sung Yoon Whang <sungyoon@uber.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants