Skip to content

[Bug] --ext with a leading dot matches no files #334

Description

@equationzhao

Describe the bug
Users commonly provide extensions with a leading dot, for example .txt. --ext .txt matches no files even when a.txt exists.

To Reproduce

  1. Build the current repository:
go build -o /tmp/g-bug-audit .
  1. Create files with different extensions:
tmp=$(mktemp -d)
touch "$tmp/a.txt" "$tmp/b.csv" "$tmp/noext"
  1. Filter using a leading-dot extension:
/tmp/g-bug-audit --no-config --disable-index --classic -A --byline --ext .txt "$tmp"
printf 'exit=%s tmp=%s\n' $? "$tmp"
  1. Actual output:
exit=0 tmp=/var/folders/1b/57vdxmgj7s1glqm6tbsw1frm0000gn/T/tmp.Q85jPTKfgM
  1. Control check without the leading dot:
/tmp/g-bug-audit --no-config --disable-index --classic -A --byline --ext txt "$tmp"

Actual control output:

a.txt
exit=0 tmp=/var/folders/1b/57vdxmgj7s1glqm6tbsw1frm0000gn/T/tmp.UcazDRUqSl
  1. Expected output: --ext .txt should list a.txt, or the CLI should reject the input with a clear validation error.

Screenshots
Not applicable.

Info (please complete the following information):

  • OS: macOS darwin/arm64
  • Version: v0.31.2, Go go1.26.1

Additional context
The extension filter appears to prepend . to the provided value. If the user already passed .txt, the effective suffix becomes ..txt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions