mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
modernize: Use strings.CutSuffix
Added in Go 1.20 Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
@@ -76,8 +76,8 @@ func GenerateKey(containerID string) string {
|
||||
|
||||
for _, v := range dir {
|
||||
id := v.Name()
|
||||
if strings.HasSuffix(id, containerID[:maxLen-1]) {
|
||||
indexStr = strings.TrimSuffix(id, containerID[:maxLen-1])
|
||||
if before, ok := strings.CutSuffix(id, containerID[:maxLen-1]); ok {
|
||||
indexStr = before
|
||||
tmpindex, err := strconv.Atoi(indexStr)
|
||||
if err != nil {
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user