The repository's .gitignore contains /*.yaml, but the repo ships tracked .yaml files at the root: .golangci.yaml, .ls-lint.yaml, and .yamllint.yaml. Since they are already tracked, the rule is inert in this repo. This is misleading and may appear contradictory though.
The real issue surfaces downstream. When a consumer runs go mod vendor, all files including .gitignore are copied into their vendor/ directory. There, the .yaml files are untracked, so the /*.yaml rule kicks in and hides them.
This breaks vendor consistency checks; go mod vendor then git status --porcelain --ignored will fail when files are ignored in vendor/ (go mod vendor produces files that git would silently drop)
Reproducer
mkdir /tmp/test && cd /tmp/test
git init
go mod init example.com/test
cat > main.go <<'EOF'
package main
import _ "go.yaml.in/yaml/v4"
func main() {}
EOF
go mod tidy
go mod vendor
git status --porcelain --ignored -- vendor/
Output includes:
!! vendor/go.yaml.in/yaml/v4/.golangci.yaml
!! vendor/go.yaml.in/yaml/v4/.ls-lint.yaml
!! vendor/go.yaml.in/yaml/v4/.yamllint.yaml
Suggested fix
Add negation rules for the shipped .yaml files:
/*.yaml
!/.golangci.yaml
!/.ls-lint.yaml
!/.yamllint.yaml
The change to .gitignore was introduced in aeb7877
The repository's
.gitignorecontains/*.yaml, but the repo ships tracked.yamlfiles at the root:.golangci.yaml,.ls-lint.yaml, and.yamllint.yaml. Since they are already tracked, the rule is inert in this repo. This is misleading and may appear contradictory though.The real issue surfaces downstream. When a consumer runs
go mod vendor, all files including.gitignoreare copied into theirvendor/directory. There, the.yamlfiles are untracked, so the/*.yamlrule kicks in and hides them.This breaks vendor consistency checks;
go mod vendorthengit status --porcelain --ignoredwill fail when files are ignored invendor/(go mod vendorproduces files that git would silently drop)Reproducer
Output includes:
Suggested fix
Add negation rules for the shipped
.yamlfiles:The change to .gitignore was introduced in aeb7877