Skip to content

Bug: verifyreadmes does not exclude hidden dot-directories on Windows #8728

Description

@RedZapdos123

Description:

On Windows, internal/tools/verifyreadmes does not exclude hidden dot-directories like .hidden, even though the current exclusion logic skips them on slash-separated platforms.

Steps to Reproduce:

  1. Check out main at b05b3d3bd.

  2. From PowerShell in the repository root, run:

    $root = Join-Path $env:TEMP 'otel-verifyreadmes-hidden'
    Remove-Item -Recurse -Force $root -ErrorAction SilentlyContinue
    
    $mod = Join-Path $root '.hidden\mod'
    New-Item -ItemType Directory -Force -Path $mod | Out-Null
    Set-Content -Path (Join-Path $mod 'go.mod') -Value "module example.com/hidden`ngo 1.25.0`n"
    
    go run ./internal/tools/verifyreadmes $root

Actual Behavior:

The tool exits non-zero and reports a missing README.md inside the hidden directory instead of skipping it.

Example output:

Verifying READMEs in C:\Users\<user>\AppData\Local\Temp\otel-verifyreadmes-hidden
Some readme files couldn't be found.
couldn't find README.md for "C:\\Users\\<user>\\AppData\\Local\\Temp\\otel-verifyreadmes-hidden\\.hidden\\mod"

Expected Behavior:

Hidden dot-directories should be excluded consistently on Windows as well, so .hidden\mod\go.mod should be skipped and the command should succeed.

Notes:

This appears to come from excludedDirs containing "/." while verifyReadme checks strings.Contains(path, dir) against OS-native paths. On Windows, the walked path uses \, so paths like C:\...\\.hidden\\mod\\go.mod never match the "/." exclusion.

This affects the internal verifyreadmes tool used by make verify-readmes and make precommit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions