Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,8 @@ func validateTargetLinks(reqForNodes map[string][]*reqForNode, drivers map[strin

func toRepoOnly(in string) (string, error) {
m := map[string]struct{}{}
p := strings.Split(in, ",")
for _, pp := range p {
n, err := reference.ParseNormalizedNamed(pp)
for ref := range strings.SplitSeq(in, ",") {
n, err := reference.ParseNormalizedNamed(ref)
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion build/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func toBuildkitExtraHosts(ctx context.Context, inp []string, nodeDriver *driver.
}
ips = append(ips, hgip.String())
} else {
for _, v := range strings.Split(ip, ",") {
for v := range strings.SplitSeq(ip, ",") {
// If the address is enclosed in square brackets, extract it
// (for IPv6, but permit it for IPv4 as well; we don't know the
// address family here, but it's unambiguous).
Expand Down
2 changes: 1 addition & 1 deletion builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func (b *Builder) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Name string
Driver string
LastActivity time.Time `json:",omitempty"`
LastActivity time.Time
Dynamic bool
Nodes []Node
Err string `json:",omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions commands/history/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type inspectOutput struct {
BuildArgs []keyValueOutput `json:",omitempty"`
Labels []keyValueOutput `json:",omitempty"`

Config configOutput `json:",omitempty"`
Config configOutput

Materials []materialOutput `json:",omitempty"`
Attachments []attachmentOutput `json:",omitempty"`
Expand Down Expand Up @@ -263,7 +263,7 @@ workers0:
readAttr(attrs, "platform", &out.Platform, func(v string) ([]string, bool) {
return tryParseValue(v, &out.Errors, func(v string) ([]string, error) {
var pp []string
for _, v := range strings.Split(v, ",") {
for v := range strings.SplitSeq(v, ",") {
p, err := platforms.Parse(v)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion commands/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func runInspect(ctx context.Context, dockerCli command.Cli, in inspectOptions) e
}
for f, dt := range nodes[i].Files {
fmt.Fprintf(w, "File#%s:\n", f)
for _, line := range strings.Split(string(dt), "\n") {
for line := range strings.SplitSeq(string(dt), "\n") {
fmt.Fprintf(w, "\t> %s\n", line)
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/docker/buildx

go 1.23.0
go 1.24.0

require (
github.com/Masterminds/semver/v3 v3.4.0
Expand Down
2 changes: 1 addition & 1 deletion tests/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func testCreateRemoteContainer(t *testing.T, sb integration.Sandbox) {
out, err = inspectCmd(sb, withArgs(remoteBuilderName))
require.NoError(t, err, out)

for _, line := range strings.Split(out, "\n") {
for line := range strings.SplitSeq(out, "\n") {
if v, ok := strings.CutPrefix(line, "Status:"); ok {
require.Equal(t, "running", strings.TrimSpace(v))
return
Expand Down
8 changes: 4 additions & 4 deletions tests/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func testInspect(t *testing.T, sb integration.Sandbox) {
var name string
var driver string
var hostGatewayIP string
for _, line := range strings.Split(out, "\n") {
for line := range strings.SplitSeq(out, "\n") {
if v, ok := strings.CutPrefix(line, "Name:"); ok && name == "" {
name = strings.TrimSpace(v)
}
Expand Down Expand Up @@ -75,7 +75,7 @@ func testInspectBuildkitdFlags(t *testing.T, sb integration.Sandbox) {
out, err = inspectCmd(sb, withArgs(builderName))
require.NoError(t, err, out)

for _, line := range strings.Split(out, "\n") {
for line := range strings.SplitSeq(out, "\n") {
if v, ok := strings.CutPrefix(line, "BuildKit daemon flags:"); ok {
require.Contains(t, v, "--oci-worker-net=bridge")
return
Expand Down Expand Up @@ -105,7 +105,7 @@ func testInspectNetworkHostEntitlement(t *testing.T, sb integration.Sandbox) {
out, err = inspectCmd(sb, withArgs(builderName))
require.NoError(t, err, out)

for _, line := range strings.Split(out, "\n") {
for line := range strings.SplitSeq(out, "\n") {
if v, ok := strings.CutPrefix(line, "BuildKit daemon flags:"); ok {
require.Contains(t, v, "--allow-insecure-entitlement=network.host")
return
Expand Down Expand Up @@ -160,7 +160,7 @@ insecure-entitlements = ["network.host", "security.insecure"]
var fileLines []string
var fileFound bool
var reConfLine = regexp.MustCompile(`^[\s\t]*>\s(.*)`)
for _, line := range strings.Split(out, "\n") {
for line := range strings.SplitSeq(out, "\n") {
if strings.HasPrefix(line, "File#buildkitd.toml:") {
fileFound = true
continue
Expand Down
2 changes: 1 addition & 1 deletion tests/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func buildkitVersion(t *testing.T, sb integration.Sandbox) string {
if !ok {
out, err := inspectCmd(sb, withArgs(sb.Address()))
require.NoError(t, err, out)
for _, line := range strings.Split(out, "\n") {
for line := range strings.SplitSeq(out, "\n") {
if v, ok := strings.CutPrefix(line, "BuildKit version:"); ok {
ver = strings.TrimSpace(v)
bkvers[sb.Name()] = ver
Expand Down
2 changes: 1 addition & 1 deletion tests/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func testLs(t *testing.T, sb integration.Sandbox) {
out, err := lsCmd(sb, withArgs(tt.args...))
require.NoError(t, err, out)
found := false
for _, line := range strings.Split(out, "\n") {
for line := range strings.SplitSeq(out, "\n") {
if strings.Contains(line, sb.Address()) {
found = true
require.Contains(t, line, sbDriver)
Expand Down
3 changes: 1 addition & 2 deletions tests/workers/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ func InitDockerWorker() {
})
// e.g. `[email protected]=/opt/docker-26.0,[email protected]=/opt/docker-25.0`
if s := os.Getenv("TEST_DOCKER_EXTRA"); s != "" {
entries := strings.Split(s, ",")
for _, entry := range entries {
for entry := range strings.SplitSeq(s, ",") {
ver, bin, err := func(entry string) (string, string, error) {
p1 := strings.Split(strings.TrimSpace(entry), "=")
if len(p1) != 2 {
Expand Down
3 changes: 1 addition & 2 deletions util/buildflags/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ func ParseAnnotations(inp []string) (map[exptypes.AnnotationKey]string, error) {
continue
}

typesSplit := strings.Split(types, ",")
for _, typeAndPlatform := range typesSplit {
for typeAndPlatform := range strings.SplitSeq(types, ",") {
groups := annotationTypeRegexp.FindStringSubmatch(typeAndPlatform)
if groups == nil {
return nil, errors.Errorf(
Expand Down