remove uses of github.com/docker/docker/pkg/stringid by thaJeztah · Pull Request #6180 · docker/cli (original) (raw)

added 2 commits

July 14, 2025 20:10

@thaJeztah

We were depending on pkg/stringid to truncate IDs for presentation. While traditionally, we used a fixed length for "truncated" IDs, this is not a strict requirement (any ID-prefix should work, but conflicts may happen on shorter IDs).

This patch adds a local TruncateID() utility in the formatter package; it's currently using the same implementation and length as the stringid.TruncateID function, but may diverge in future.

Signed-off-by: Sebastiaan van Stijn github@gone.nl

@thaJeztah

This utility was only used for testing, and to generate a random suffix for Dockerfiles. As we don't need the same contract as pkg/stringid.GenerateRandomID() (not allow all-numeric IDs as they would not be usable for hostnames), we can use a local test-utility, and local implementation for the random suffix instead.

Signed-off-by: Sebastiaan van Stijn github@gone.nl

Benehiko

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})