riferrei / srclient

Golang Client for Schema Registry
Apache License 2.0
236 stars 70 forks source link

functional options and linting #101

Closed survivorbat closed 5 months ago

survivorbat commented 1 year ago

Hey there,

I feel motivated to collaborate on the project a bit more and I have 2 suggestions that I'd like feedback on.

The first one concerns linting. I've recently adapted golangci-lint in all my projects and with some custom config was able to find loads of improvements in my own code. Would it be an idea to add that here too? To enforce code style and catch common issues (like preallocation of slices etc.)

The second suggestion would be an improvement of the constructor method. Instead of just CreateSchemaRegistry and its advanced variant, I'd love to add:

NewSchemaRegistry(url, options...)

With the options being:

This would allow us to expand the options in the future without adding more constructors, furthermore it's also more in line with Go's convention of using New. We can also set defaults more sensibly.

I'd love to hear your thoughts on this, I might work on a PR to reflect the suggestions.

AtakanColak commented 5 months ago

Hello, I'm afraid I have been away from Go development for a long time now.

I've approved your PR, and closing this issue due to inactivity, please do open a PR for new features (or a new issue for new discussions)