go-github-mock icon indicating copy to clipboard operation
go-github-mock copied to clipboard

Suggest to remove unnecessary dependencies

Open meling opened this issue 1 year ago • 2 comments

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.

meling avatar May 26 '24 09:05 meling

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: .

migueleliasweb avatar May 26 '24 09:05 migueleliasweb

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

meling avatar May 26 '24 10:05 meling

Closing this for now. It'll come back if any of these issues become pressing again.

migueleliasweb avatar Dec 02 '24 02:12 migueleliasweb