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

Expose api for embed in user program. #94

Closed
leaxoy opened this issue Mar 19, 2023 · 3 comments · Fixed by #181
Closed

Expose api for embed in user program. #94

leaxoy opened this issue Mar 19, 2023 · 3 comments · Fixed by #181
Labels
enhancement New feature or request

Comments

@leaxoy
Copy link

leaxoy commented Mar 19, 2023

All apis in gopatch is internal, user must invoke this by external command, pre-requirements is gopatch installed in user machine.

So expose api for embed is convenient

@abhinav
Copy link
Contributor

abhinav commented Apr 25, 2023

The choice to hide APIs was made due to an overabundance of caution.
I think it's valid that a small surface area could be exposed—more over time as internals are solidified.

As a starting point to iterate on, I think something like following could be safely exposed
while keeping the internals hidden.

type PatchFile struct{ ... }

func Parse(filename string, src []byte) (*PatchFile, error)

func (*PatchFile) Apply(src []byte) ([]byte, error)

CC @lverma14 @r-hang

@sywhang sywhang added the enhancement New feature or request label Apr 25, 2023
@sywhang
Copy link
Contributor

sywhang commented Apr 25, 2023

internal ref: GO-2003

@vvakame
Copy link
Contributor

vvakame commented Feb 5, 2025

Hi! I tried gopatch to reproduce my changes by gopatch.
I did it in half day. I thought it was a very wonderful tool!

I'm using the https://github.com/spf13/afero and I want to apply a patch to something that isn't an actual file.
so, I need some APIs.

I created #181 . PTAL 🙏 If you have a time @abhinav @sywhang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

4 participants