Skip to content

[BUG] go test fails on Windows: pkg/compose/hook_test.go calls console.NewPty (missing build tags) #13682

@ishwar170695

Description

@ishwar170695

Description

Running go test on native Windows fails to build github.com/docker/compose/v5/pkg/compose because pkg/compose/hook_test.go calls github.com/containerd/console.NewPty(), which is not available on Windows.

Actual behavior

# github.com/docker/compose/v5/pkg/compose [github.com/docker/compose/v5/pkg/compose.test]
.\hook_test.go:70:35: undefined: console.NewPty
FAIL    github.com/docker/compose/v5/pkg/compose [build failed]
FAIL

Expected behavior

Windows-native go test should not fail at compile time due to Unix-only PTY usage; PTY-dependent tests should be excluded via Go build constraints (or similar gating).

Suggested fix

Add a build constraint to pkg/compose/hook_test.go, e.g.

//go:build !windows
// +build !windows

Steps To Reproduce

Environment

  • OS: Windows (native, not WSL)
  • Go: go version go1.25.4 windows/amd64
  • Repo: docker/compose
  • Commit: 579bbe7a87cf766a126ac24002d235bdc4dc360e

To Reproduce

  1. Clone docker/compose at commit 579bbe7a87cf766a126ac24002d235bdc4dc360e
  2. On Windows (native, not WSL), run from pkg/compose:
    go test .

Compose Version


Docker Environment


Anything else?

Discovered while working on #13674. No existing build constraints found in hook_test.go; a quick audit of other test files in pkg/compose may reveal similar gaps.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions