warg
workgroup
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
warg
-
An Efficient Struct Configuration Pattern For Golang
Funcopts aren't always appropriate, but boy do they make things more readable sometimes. I use them pervasively in warg to allow declarative nested CLI commands
-
Which packages do you recommend for building cli tools?
I wrote my own! https://github.com/bbkane/warg/
-
Major standard library changes in Go 1.20
Very useful! I'll be playing with the error tree additions and studying the HTTP interface extension to see if I can replicate the pattern for https://github.com/bbkane/warg values. Id like to be able to have value-specific output for different types of --help , even ones not in warg
-
Have you used generics?
I'm using to allow for custom flag types in my CLI parsing library- a lot less duplicate code
-
Go: Functional Options Are Slow
One thing that I find nicer with functional options is building tree-like data structures.
My command line parsing library uses them to declaratively build CLI apps with arbitrarily nested subcommands.
Some examples at https://github.com/bbkane/warg/tree/master/examples
-
How are YOU using generics so far?
I'm writing a CLI parsing library, and generics have let me consolidate most of the flag value functionality for different types. So the flags for dbz --level 9000 --type superSaiyan share most of the same code even though one is an int and one is a string. So much fewer copy-paste-modify lines of code now!
-
Unix command line conventions over time
This is largely what the Azure CLI does. It simplifies even further by eliminating the no-value option. Instead, you pass "true" or "false" as the value ( --example true ). It's a little more verbose but very easy to parse/write/generate. I like this convention so much I stole it for my homemade Golang CLI parsing library https://github.com/bbkane/warg/ .
workgroup
-
Gworker, the most easily configurable Generic worker pool implementation
I still think my worker pool is the best: https://github.com/carlmjohnson/workgroup
- A lot of boilerplate code when writing asynchronous code in go
- Workgroup: An easy to use concurrent task manager
-
Implementing Thread/Worker pool using Go generics
I have one that I’ve been using for a while and just updated to use Go 1.20 multierrors: https://github.com/carlmjohnson/workgroup
-
How idiomatic is this?
Read https://blog.carlmjohnson.net/post/share-memory-by-communicating/ and look at the code in https://github.com/carlmjohnson/workgroup for reference.
-
How are YOU using generics so far?
So far, just refactoring. I made a concurrency manager to simplify some stuff, and unified some pagination code. It’s like we said before generics: there are places you miss it, but not having it was never a total blocker. I think going working the x/slices x/maps packages will be the biggest time savers.
-
Go, Generics, and Concurrency
Yeah, I wrote my own generic concurrency thing, and it has two functions. There's a high level Process(nWorkers, task, manager, initial) and a lower level Start(nWorkers, task) (in chan<- Input, out <-chan Result[Input, Output]). The high level function is built off of the low level one and just queues jobs for the task workers by giving job results to the manager to see if it produces any more work. Context isn't involved in either because the idea is that the tasks should have their own internal contexts. You don't want to cancel the task runner, you want to cancel the tasks!
What are some alternatives?
graph - A library for creating generic graph data structures and modifying, analyzing, and visualizing them.
next-pwa - Zero config PWA plugin for Next.js, with workbox 🧰 with appDir support
cli-guidelines - A guide to help you write better command-line programs, taking traditional UNIX principles and updating them for the modern day.
watchman - AML/CTF/KYC/OFAC Search of global watchlist and sanctions
golang-generics-dao-example - Example using Generics with DAO
golpo - Social network using react and express (old version of the current golpo.dedsec.life)
scan - Scan provides the ability to to scan sql rows directly to any defined structure.
elegalio-template - Responsive and modern website template, made with React.
RCIG_Coordination_Repo - A Coordination repo for all things Rust Cryptography oriented
BetterMeet - An open community platform
infra - Infra provides authentication and access management to servers and Kubernetes clusters.
fokus - react web app to help you become more productive :fire: and efficient with time:star2: