komuw / ong

ong, is a Go http toolkit.
MIT License
16 stars 4 forks source link

ong/id: use base32 instead of base64 #409

Closed komuw closed 5 months ago

komuw commented 5 months ago

This is done because Go v1.22 made a breaking change where the alphabet passed into base64.NewEncoding(alphabet) should no longer contain duplicate[1] characters.
The alphabet previously used by ong/id contained duplicates in order to reduce ambiguity.

In this PR we change to base32, since the alphabet size is smaller than base64 and we can thus eliminate ambiguity from it without using duplicate characters.

Example of the id's generated now;

XCCa43QReQrre7Gd
G3DXeDNBDEFChB3W
gTt2DeXQq4N5F33r
  1. https://github.com/golang/go/commit/243c8c0eec20d981d8e76a3aac82f97cca991571
codecov-commenter commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (da241d7) 72.93% compared to head (9940e96) 69.65%. Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #409 +/- ## ========================================== - Coverage 72.93% 69.65% -3.29% ========================================== Files 49 52 +3 Lines 5868 6192 +324 ========================================== + Hits 4280 4313 +33 - Misses 1273 1556 +283 - Partials 315 323 +8 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.