ugorji / go

idiomatic codec and rpc lib for msgpack, cbor, json, etc. msgpack.org[Go]
MIT License
1.83k stars 294 forks source link

runtime error with golang master (furture go 1.22) #407

Closed LeGEC closed 8 months ago

LeGEC commented 8 months ago

in the golang repository, the stdlib package encoding/base64 received this commit:

https://github.com/golang/go/commit/243c8c0eec20d981d8e76a3aac82f97cca991571

The base64.NewEncoding() function now checks explicitly for duplicate symbols in the alphabet input string.

It turns out that a hacky way to generate names in gen.go:

        genBase64enc  = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789__")

https://github.com/ugorji/go/blob/master/codec/gen.go#L193

uses a duplicate character (two _ characters at the end).

I don't know if the appropriate fix is to use another custom alphabet or use a base62 alphabet or use the RawStdEncoding and replace the unwanted characters,
but the current code will make any binary compiled with the gotip version fail as soon as started (this base64.NewEncoding() happens at init() time)