Skip to content

docker/compose/v5 will not compile with v29.3.0+incompatible #6877

@pedantic79

Description

@pedantic79

Description

Compiling with v29.3.0+incompatible produces compilation error when including github.com/docker/compose/v5 v5.1.1.

../go/pkg/mod/github.com/docker/cli@v29.3.0+incompatible/cli/command/container/tty.go:63:23: cannot range over 10 (untyped int constant): requires go1.22 or later (-lang was set to go1.16; check go.mod)

This makes it impossible to use docker/compose as you need docker/cli to initialize the ComposeService

Reproduce

I have a very small reproduce of this: https://github.com/pedantic79/docker-bug/tree/main

Where the compilation error will occur.

go.mod contains

require (
	github.com/docker/cli v29.3.0+incompatible
	github.com/docker/compose/v5 v5.1.1
)

main.go contains

func main() {
	dockerCli, _ := command.NewDockerCli()
	composeService, _ := compose.NewComposeService(dockerCli)
	fmt.Println(composeService) // avoid compiler complaining about unused variable
}

Expected behavior

Program to compile

docker version

N/A

docker info

N/A

Additional Info

I can pin to v29.2.1+incompatible and that fixes the issue, as that version doesn't use the for retry := range 10 that was introduced in v29.3.0+incompatible

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions