gopatch icon indicating copy to clipboard operation
gopatch copied to clipboard

Expose api for embed in user program.

Open leaxoy opened this issue 2 years ago • 2 comments

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

leaxoy avatar Mar 19 '23 02:03 leaxoy

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

abhinav avatar Apr 25 '23 17:04 abhinav

internal ref: GO-2003

sywhang avatar Apr 25 '23 18:04 sywhang