File tree Expand file tree Collapse file tree 3 files changed +5
-11
lines changed
Expand file tree Collapse file tree 3 files changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -182,14 +182,10 @@ func uxImage(cmd cli.Command) cli.Command {
182182 if ctx .IsSet ("image" ) {
183183 image := ctx .String ("image" )
184184
185- var dir , tag string
186- sep := strings .Index (image , ":" )
187- if sep == - 1 {
185+ dir , tag , ok := strings .Cut (image , ":" )
186+ if ! ok {
188187 dir = image
189188 tag = "latest"
190- } else {
191- dir = image [:sep ]
192- tag = image [sep + 1 :]
193189 }
194190
195191 // Verify directory value.
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ import (
3131// Used by walkState.mark() to determine which struct members are descriptors to
3232// recurse into them. We aren't interested in struct members which are not
3333// either a slice of ispec.Descriptor or ispec.Descriptor themselves.
34- var descriptorType = reflect .TypeOf ( ispec.Descriptor {} )
34+ var descriptorType = reflect .TypeFor [ ispec.Descriptor ]( )
3535
3636// DescriptorMapFunc is a function that is used to provide a mapping between
3737// different descriptor values with MapDescriptors. It will not be called
Original file line number Diff line number Diff line change @@ -40,8 +40,6 @@ const (
4040// should only be used for OCI media-types, where this behaviour is
4141// well-defined.
4242func SplitMediaTypeSuffix (mediaType string ) (baseType , suffix string ) {
43- if suffixStart := strings .Index (mediaType , "+" ); suffixStart >= 0 {
44- return mediaType [:suffixStart ], mediaType [suffixStart + 1 :]
45- }
46- return mediaType , ""
43+ baseType , suffix , _ = strings .Cut (mediaType , "+" )
44+ return baseType , suffix
4745}
You can’t perform that action at this time.
0 commit comments