You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As we're trying to use as few external dependencies as possible in Wakapi, I looked into how duke-git/lancet/slice might be replaced with latest standard library methods.
The following table lists all slice methods we're currently using in the code base. However, looks like there's not yet an stdlib equivalent for all of them (happy to learn otherwise).
Of course, things like Filter could also be written out as a loop, however, I prefer code compactness and readability in this case.
Introducing slog-sentry unfortunately brought in lo as another dependency. It does pretty much exactly the same as lancet (I went for lancet, because lo didn't exist at the time (shortly after Go generics were introduced)).
To eliminate lancet as a dependency, I'd propose to:
Replace all function calls with stdlib equivalents wherever possible
Replace all remaining ones with lo euqivalents
Hopefully none are left
Need to fill another column for lo in the table above.
Whoever wants to jump onto this refactoring, go for it! It's super low-prio, though, because there won't be an actual benefit for the user. Only advantage will be one less dependency and thus adds a bit to keeping Wakapi light-weight.
As we're trying to use as few external dependencies as possible in Wakapi, I looked into how duke-git/lancet/slice might be replaced with latest standard library methods.
The following table lists all slice methods we're currently using in the code base. However, looks like there's not yet an stdlib equivalent for all of them (happy to learn otherwise).
Of course, things like
Filter
could also be written out as a loop, however, I prefer code compactness and readability in this case.lancet
methodlo
methodslice.Contain
slices.Contains
slice.ContainBy
slices.ContainsFunc
slice.Find
slices.IndexFunc
(not quite the same)slice.Filter
slice.Unique
slices.Sorted
+slices.Compact
slice.Map
slice.SortByField
slices.SortedFunc
slice.GroupWith
The text was updated successfully, but these errors were encountered: