oci: replace some fmt.Sprintfs with strconv

Teeny-tiny optimizations:

    BenchmarkSprintf-10       37735996    32.31  ns/op  0 B/op  0 allocs/op
    BenchmarkItoa-10         591945836     2.031 ns/op  0 B/op  0 allocs/op
    BenchmarkFormatUint-10   593701444     2.014 ns/op  0 B/op  0 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-06-23 13:06:03 +02:00
parent 710d22366d
commit 06765c9ef5
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -420,7 +420,7 @@ func WithImageConfigArgs(image Image, args []string) SpecOpts {
if err := WithUser(config.User)(ctx, client, c, s); err != nil { if err := WithUser(config.User)(ctx, client, c, s); err != nil {
return err return err
} }
return WithAdditionalGIDs(fmt.Sprintf("%d", s.Process.User.UID))(ctx, client, c, s) return WithAdditionalGIDs(strconv.FormatInt(int64(s.Process.User.UID), 10))(ctx, client, c, s)
} }
// we should query the image's /etc/group for additional GIDs // we should query the image's /etc/group for additional GIDs
// even if there is no specified user in the image config // even if there is no specified user in the image config