migueleliasweb / go-github-mock

A library to aid unittesting code that uses Golang's Github SDK
MIT License
94 stars 22 forks source link

Suggest to remove unnecessary dependencies #68

Open meling opened 1 month ago

meling commented 1 month ago

I'm considering to use this library to mock our custom wrapper around go-github. Would you consider removing the github.com/go-kit/log dependency, e.g., just print using fmt or the std lib logger?

I'm also not sure about the rationale for using the github.com/buger/jsonparser. Could the std lib json parser be used instead?

Why? Well, I've looked at the code, and the logger and json parser is only used by the command line tool. Hence, it is unfortunate that users of the mock part must bring in extra (indirect) dependencies that aren't needed for their use case.

PS: You may be interested in the v2 json-experiment that may come in a future Go release.

migueleliasweb commented 1 month ago

Hi @meling , thanks for reaching out.

Would you consider removing the github.com/go-kit/log dependency, e.g., just print using fmt or the std lib logger?

The go-kit/log would be the easiest to get rid of. Using either the native logger or fmt is probably good enough.

I'm also not sure about the rationale for using the github.com/buger/jsonparser. Could the std lib json parser be used instead?

The case for the jsonparser is different. It's used to provide a dynamic parsing for the Github OpenApiSchema. Without it, although technically possible, one would have to juggle a multi-level map[string]any and given the structure, that would become messy. I'm happy to review a contributiion if you're interested to give it a shot.

PS: You may be interested in the v2 json-experiment that may come in a future Go release.

I'll keep an eye on it :+1: .

meling commented 1 month ago

Thanks for the quick reply. Yeah, I thought there might be more to it with the jsonparser. I'm okay with keeping that, then.