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

Add the possibility of using as a library #121

Open
cardinalby opened this issue Jan 28, 2024 · 0 comments
Open

Add the possibility of using as a library #121

cardinalby opened this issue Jan 28, 2024 · 0 comments

Comments

@cardinalby
Copy link

Hi and thx for the great tool!

Currently the go application contains only main package that directly reads command line args and outputs to stdout.

If one wants to re-use it in inside an own go build application its impossible to do

It would be nice to decompose to

  • pkg with the all the logic:
    1. exported config structs
    2. Build function that accepts the configs and optional logger and returns error
  • main package that
    1. parses flags, converts them to config structs
    2. calls Build from pkg connecting logger to stdout and prints an error if any

The resulting behavior will not change, but it will be possible to reuse pkg in other tools

I made the changes in a separate repo at the moment: https://github.com/cardinalby/xgo-as-library, but would like to create a PR to implement it inside your repo instead if you like the idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants