Skip to content

Wrong base36 example in pkg/dns/encoding.go doc comment #434

Description

@scttfrdmn

pkg/dns/encoding.go has a doc-comment example that doesn't match the actual output of big.Int.Text(36):

// EncodeAccountID converts AWS account ID (12 decimal digits) to base36 (7 chars)
// Example: "123456789012" -> "1s69p4h"

Standard base-36 of 123456789012 is 1kpqzg2c (8 chars), not 1s69p4h. Verified with Python, Node (BigInt("123456789012").toString(36)), and against the sibling implementation in lambda/dns-updater/main.go, whose getFullDNSName doc comment correctly shows -> my-instance.1kpqzg2c.spore.host for the same input.

So the two files give contradictory examples for identical logic; pkg/dns/encoding.go's is the stale/incorrect one. Also note the "(7 chars)" is misleading — 12-digit account ids encode to 8 base36 chars.

Cosmetic (doc-only; the code is correct), but confusing when reimplementing the DNS-name scheme against it. Found while building a browser-side reproduction of the {name}.{base36(account)}.spore.host naming for a spawn-ts demo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions