I’m new to Go, using it because there is an existing tool (a CLI called
git-bug) which I wish to make use of in a web application running in the browser by compiling to WebAssembly. I’ve done some basic tests and have a ‘hello wasm’ app written in go.
My cunning plan requires that I fool the tool (
git-bug) into working even though it expects a filesystem using the Go
os package. So I’m looking for the best way to achieve this, such as:
make it possible to call
git-bugas a Golang library, by making a modified build of
git-bug. I haven’t looked into that yet, because the second thing is more tricky, so I want to be sure i can do that first, which is…
git-bugcalls to the filesystem (via the
ospackage) to my own library, which will provide a replica filesystem API, but in the browser.
So I’m looking for help on the second point first (although tips or pointers to examples on the first are welcome).
I have the Golang source and with it can see the code for the
os package but am not sure of my options for substituting the relevant parts of the
os package. For example, do I need to make a complete replica, or can I replace APIs at runtime?
And if I make a replica package, how would I cause
git-bug to be built with that while minimising changes to the
git-bug code (e.g. can I replace the
os package with a custom build configuration?).
Thanks. For anyone interested, my project repo is safenetwork-gitportal.
I have a diagram which might help: