mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-11-03 09:37:34 +00:00
Merge pull request #29527 from vishnukothakapu/perf-strings-equalfold
Performance: Replace strings.ToLower with strings.EqualFold
This commit is contained in:
commit
4b6873a5ef
7 changed files with 7 additions and 7 deletions
|
|
@ -731,7 +731,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *Buil
|
|||
// otherwise it returns true
|
||||
func useLayers() string {
|
||||
layers := os.Getenv("BUILDAH_LAYERS")
|
||||
if strings.ToLower(layers) == "false" || layers == "0" {
|
||||
if strings.EqualFold(layers, "false") || layers == "0" {
|
||||
return "false"
|
||||
}
|
||||
return "true"
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ func (r *Runtime) newVolume(ctx context.Context, noCreatePluginVolume bool, opti
|
|||
for key, val := range volume.config.Options {
|
||||
switch strings.ToLower(key) {
|
||||
case "device":
|
||||
if strings.ToLower(volume.config.Options["type"]) == define.TypeBind {
|
||||
if strings.EqualFold(volume.config.Options["type"], define.TypeBind) {
|
||||
if err := fileutils.Exists(val); err != nil {
|
||||
return nil, fmt.Errorf("invalid volume option %s for driver 'local': %w", key, err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ func createAnonymousFilterVolumeFunction(filterValues []string) (libpod.VolumeFi
|
|||
return func(v *libpod.Volume) bool {
|
||||
for _, val := range filterValues {
|
||||
anon := v.Anonymous()
|
||||
invert := strings.ToLower(val) == "false" || val == "0"
|
||||
invert := strings.EqualFold(val, "false") || val == "0"
|
||||
if invert {
|
||||
anon = !anon
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ func setUpClusterClient(kconfig k8sAPI.Config, applyOptions entities.ApplyOption
|
|||
caCertPool := x509.NewCertPool()
|
||||
|
||||
// Be insecure if user sets ca-cert-file flag to insecure
|
||||
if strings.ToLower(caCertFile) == "insecure" {
|
||||
if strings.EqualFold(caCertFile, "insecure") {
|
||||
insecureSkipVerify = true
|
||||
} else if caCertFile == "" {
|
||||
caCertFile = kconfig.Clusters[0].Cluster.CertificateAuthority
|
||||
|
|
|
|||
|
|
@ -1021,5 +1021,5 @@ func promptUpdateSystemConn() (bool, error) {
|
|||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return strings.ToLower(answer)[0] == 'y', nil
|
||||
return len(answer) > 0 && (answer[0] == 'y' || answer[0] == 'Y'), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ func supportAmbientCapabilities() bool {
|
|||
|
||||
func shouldMask(mask string, unmask []string) bool {
|
||||
for _, m := range unmask {
|
||||
if strings.ToLower(m) == "all" {
|
||||
if strings.EqualFold(m, "all") {
|
||||
return false
|
||||
}
|
||||
for m1 := range strings.SplitSeq(m, ":") {
|
||||
|
|
|
|||
|
|
@ -1215,7 +1215,7 @@ func ParseRestartPolicy(policy string) (string, uint, error) {
|
|||
case 1:
|
||||
// No retries specified
|
||||
policyType = splitRestart[0]
|
||||
if strings.ToLower(splitRestart[0]) == "never" {
|
||||
if strings.EqualFold(splitRestart[0], "never") {
|
||||
policyType = define.RestartPolicyNo
|
||||
}
|
||||
case 2:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue