Skip to content

x/mod/modfile: IsDirectoryPath produces a false negative on some short clean directory paths #60572

Closed
@dmitshur

Description

@dmitshur

In #51448 (comment), Bryan wrote:

The argument . should trigger modfile.IsDirectoryPath here:
https://cs.opensource.google/go/go/+/ce427cf96128b545ae473983bafb6a0b80ecaa08:src/cmd/go/internal/modload/modfile.go;l=805-807

But it doesn't: this looks like a bug in IsDirectoryPath, which does not expect to ever need to refer to a module in the same directory (compare #34417).

For Go 1.19, we should probably fix up modfile.IsDirectoryPath. For 1.18, perhaps we should change the condition to if path == "." || modfile.IsDirectoryPath(path).

The Go 1.18 condition change happened in CL 389298. This is the tracking issue for the bug in modfile.IsDirectoryPath that we can still fix in Go 1.22 or later. (Or even in Go 1.21 if this bug fix is considered okay in the current pre-RC1 phase of the release freeze.)

I'll send a CL.

CC @bcmills, @matloob.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions