mirror of
https://github.com/docker/compose.git
synced 2026-02-09 01:59:22 +08:00
refactor: use slices.Contains to simplify code
Signed-off-by: tongjicoder <tongjicoder@icloud.com>
This commit is contained in:
committed by
Nicolas De loof
parent
d49a68ecbf
commit
2e71440bee
@@ -23,6 +23,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
pusherrors "github.com/containerd/containerd/v2/core/remotes/errors"
|
||||
@@ -157,14 +158,7 @@ func isNonAuthClientError(statusCode int) bool {
|
||||
// not a client error
|
||||
return false
|
||||
}
|
||||
for _, v := range clientAuthStatusCodes {
|
||||
if statusCode == v {
|
||||
// client auth error
|
||||
return false
|
||||
}
|
||||
}
|
||||
// any other 4xx client error
|
||||
return true
|
||||
return !slices.Contains(clientAuthStatusCodes, statusCode)
|
||||
}
|
||||
|
||||
func generateManifest(layers []v1.Descriptor, ociCompat api.OCIVersion) ([]Pushable, error) {
|
||||
|
||||
Reference in New Issue
Block a user