4 ms·
Coral, a Cobra fork with nearly all its features, but only 4 dependencies
- nikolay 5y agoChristian Muehlhaeuser (@muesli) is an outstanding 10x developer and all his projects and contributions are pretty remarkable!
- orblivion 5y agoI recognize that handle and avatar from following him on Mastodon. (assuming it's actually him)
- nikolay 5y agoHe has a different personal branding [0],[1] outside of GitHub [0]: https://fribbledom.com/ https://fribbledom.com/ [1]: https://mastodon.social/@fribbledom https://mastodon.social/@fribbledom
- kkirsche 5y agoThis looks amazing. Viper was something I’ve always removed from my projects as they’re simple tools usually where configuration files don’t make sense, so I really appreciate you sharing this. Excited to see where it goes!
- rad_gruchalski 5y agoInteresting. I wasn’t usually using viper but on a recent project it was handy.
- mountainriver 5y agoI want to like Viper but I always find it’s behavior really strange.
- rad_gruchalski 5y agoWhich features are missing?
- devonkim 5y agoFrom a quick look it still leverages viper integration for 12 Factor Apps, and since most of Coral’s features are well listed and detailed I’m going to make a presumption that Coral does not support reading environment variables (yet? Seems easy, maybe an opinionated decision?) not from external key value stores like Consul and Etcd. Client libraries for those would certainly cause a lot of extra dependencies.
- bigdubs 5y ago4 ... of its 5 dependencies. It's just missing Viper. We should do a better job with the title here. See: - [0] https://github.com/muesli/coral/blob/master/go.mod https://github.com/muesli/coral/blob/master/go.mod - [1] https://github.com/spf13/cobra/blob/master/go.mod https://github.com/spf13/cobra/blob/master/go.mod
- lbhdc 5y agoThe dependency that was dropped has many dependencies that would get added to your project. https://github.com/spf13/viper/blob/master/go.mod https://github.com/spf13/viper/blob/master/go.mod
- jjnoakes 5y agoRight but that last one is the problem... https://github.com/muesli/coral/blob/master/go.sum https://github.com/muesli/coral/blob/master/go.sum https://github.com/spf13/cobra/blob/master/go.sum https://github.com/spf13/cobra/blob/master/go.sum
- racingmars 5y ago...but that fifth dependency makes all the difference! $ go mod init foo && go get github.com/spf13/cobra && wc -l go.sum 758 go.sum $ go mod init foo && go get github.com/muesli/coral && wc -l go.sum 10 go.sum (Number of lines in go.sum != number of transitive dependencies, of course, but the scale of the difference still hints at how much extra is being pulled into your project.)
- CraigJPerry 5y agoI like this from the readme: It's easy to use Coral as a drop-in replacement for Cobra in existing projects, just let gofmt do the heavy lifting for you: gofmt -w -r '"github.com/spf13/cobra" -> "github.com/muesli/coral"' . gofmt -w -r '"github.com/spf13/cobra/doc" -> "github.com/muesli/coral/doc"' . gofmt -w -r 'cobra -> coral' . go mod tidy Having implemented something to do a similar one off refactor in java for thousands of files, that is a breath of fresh air. In java i had to go code -> AST -> perform manipulations -> generate code from AST (with inevitable long PR’s due to generated code not matching 1:1 with parsed original). After having gone through that i think if i had to repeat again with java I’d probably try harder to use structural find and replace.
- _old_dude_ 5y agoI've recently used rewrite that comes with YAML recipes [1] for the common refactoring [1] https://docs.openrewrite.org/reference/yaml-format-reference https://docs.openrewrite.org/reference/yaml-format-reference
- elesbao 5y agoI love the things that the charm gang is working on and the associated projects. The only things that are dragging me out from Rust to Go https://github.com/charmbracelet/ https://github.com/charmbracelet/
- chris_st 5y agoIndeed. I've built a few applications recently, and their Bubbletea and Lipgloss libraries are just wonderful to use.