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:
@@ -420,8 +420,8 @@ func (v *localVolume) LiveRestoreVolume(ctx context.Context, _ string) error {
|
||||
// getAddress finds out address/hostname from options
|
||||
func getAddress(opts string) string {
|
||||
for opt := range strings.SplitSeq(opts, ",") {
|
||||
if strings.HasPrefix(opt, "addr=") {
|
||||
return strings.TrimPrefix(opt, "addr=")
|
||||
if after, ok := strings.CutPrefix(opt, "addr="); ok {
|
||||
return after
|
||||
}
|
||||
}
|
||||
return ""
|
||||
@@ -430,8 +430,8 @@ func getAddress(opts string) string {
|
||||
// getPassword finds out a password from options
|
||||
func getPassword(opts string) string {
|
||||
for opt := range strings.SplitSeq(opts, ",") {
|
||||
if strings.HasPrefix(opt, "password=") {
|
||||
return strings.TrimPrefix(opt, "password=")
|
||||
if after, ok := strings.CutPrefix(opt, "password="); ok {
|
||||
return after
|
||||
}
|
||||
}
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user