Skip to content

[Bug] --no-ext with a leading dot fails to exclude matching files #335

Description

@equationzhao

Describe the bug
--no-ext .txt should exclude a.txt, but it leaves it in the output.

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. Exclude a leading-dot extension:
/tmp/g-bug-audit --no-config --disable-index --classic -A --byline --no-ext .txt "$tmp"
printf 'exit=%s tmp=%s\n' $? "$tmp"
  1. Actual output:
a.txt
b.csv
noext
exit=0 tmp=/var/folders/1b/57vdxmgj7s1glqm6tbsw1frm0000gn/T/tmp.KVFkWQ4vdQ
  1. Control check without the leading dot:
/tmp/g-bug-audit --no-config --disable-index --classic -A --byline --no-ext txt "$tmp"

Actual control output:

b.csv
noext
exit=0 tmp=/var/folders/1b/57vdxmgj7s1glqm6tbsw1frm0000gn/T/tmp.kC5Zi304XL
  1. Expected output: a.txt should be excluded when the user passes .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 exclusion 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