mirror of
https://github.com/containerd/containerd.git
synced 2026-11-06 05:17:02 +00:00
*: modernize: stringsseq
go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
modernize -stringsseq -fix ./...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
8 files changed
+13
-13
No files matched your search
@@ -211,8 +211,8 @@ func validateTopic(topic string) error {
|
||||
return fmt.Errorf("must have at least one component: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
|
||||
components := strings.Split(topic[1:], "/")
|
||||
for _, component := range components {
|
||||
components := strings.SplitSeq(topic[1:], "/")
|
||||
for component := range components {
|
||||
if err := identifiers.Validate(component); err != nil {
|
||||
return fmt.Errorf("failed validation on component %q: %w", component, err)
|
||||
}
|
||||
|
||||
@@ -729,7 +729,7 @@ func parseRange(s string, size int64) ([]httpRange, error) {
|
||||
}
|
||||
var ranges []httpRange
|
||||
noOverlap := false
|
||||
for _, ra := range strings.Split(s[len(b):], ",") {
|
||||
for ra := range strings.SplitSeq(s[len(b):], ",") {
|
||||
ra = textproto.TrimString(ra)
|
||||
if ra == "" {
|
||||
continue
|
||||
|
||||
@@ -123,7 +123,7 @@ func selectRepositoryMountCandidate(refspec reference.Spec, sources map[string]s
|
||||
|
||||
n, match := 0, ""
|
||||
components := strings.Split(target, "/")
|
||||
for _, repo := range strings.Split(repoLabel, ",") {
|
||||
for repo := range strings.SplitSeq(repoLabel, ",") {
|
||||
// the target repo is not a candidate
|
||||
if repo == target {
|
||||
continue
|
||||
|
||||
@@ -1374,7 +1374,7 @@ func getXxxset(t *testing.T, kind, path string) []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, rng := range strings.Split(strings.TrimSpace(string(data)), ",") {
|
||||
for rng := range strings.SplitSeq(strings.TrimSpace(string(data)), ",") {
|
||||
var (
|
||||
lo int
|
||||
hi = -1
|
||||
|
||||
@@ -236,8 +236,8 @@ func ensureShared(path string, lookupMount func(string) (mount.Info, error)) err
|
||||
}
|
||||
|
||||
// Make sure source mount point is shared.
|
||||
optsSplit := strings.Split(mountInfo.Optional, " ")
|
||||
for _, opt := range optsSplit {
|
||||
optsSplit := strings.SplitSeq(mountInfo.Optional, " ")
|
||||
for opt := range optsSplit {
|
||||
if strings.HasPrefix(opt, "shared:") {
|
||||
return nil
|
||||
}
|
||||
@@ -253,8 +253,8 @@ func ensureSharedOrSlave(path string, lookupMount func(string) (mount.Info, erro
|
||||
return err
|
||||
}
|
||||
// Make sure source mount point is shared.
|
||||
optsSplit := strings.Split(mountInfo.Optional, " ")
|
||||
for _, opt := range optsSplit {
|
||||
optsSplit := strings.SplitSeq(mountInfo.Optional, " ")
|
||||
for opt := range optsSplit {
|
||||
if strings.HasPrefix(opt, "shared:") {
|
||||
return nil
|
||||
} else if strings.HasPrefix(opt, "master:") {
|
||||
|
||||
@@ -83,7 +83,7 @@ func NewV4Options(req *http.Request) (*V4Options, error) {
|
||||
if len(portString) == 0 {
|
||||
return nil, fmt.Errorf("query parameter %q cannot be empty", api.PortHeader)
|
||||
}
|
||||
for _, p := range strings.Split(portString, ",") {
|
||||
for p := range strings.SplitSeq(portString, ",") {
|
||||
port, err := strconv.ParseUint(p, 10, 16)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to parse %q as a port: %v", portString, err)
|
||||
|
||||
@@ -99,7 +99,7 @@ func (i *IDMap) Unmarshal(uidMap, gidMap string) error {
|
||||
if len(str) == 0 {
|
||||
return nil
|
||||
}
|
||||
for _, mapping := range strings.Split(str, ",") {
|
||||
for mapping := range strings.SplitSeq(str, ",") {
|
||||
m, err := deserializeLinuxIDMapping(mapping)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -367,8 +367,8 @@ func TestBinDirVerifyImage(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
lines := strings.Split(string(b), "\n")
|
||||
for _, l := range lines {
|
||||
lines := strings.SplitSeq(string(b), "\n")
|
||||
for l := range lines {
|
||||
// Ignore defunct (zombie) verifier processes if PID 1 hasn't reaped them.
|
||||
// TODO: Remove defunct check once containerd serves as subreaper for verifier processes.
|
||||
if strings.Contains(l, "verifier-") && !strings.Contains(l, "<defunct>") {
|
||||
|
||||
Reference in new issue
Block a user