Hold every source file to a README Layout line

This commit is contained in:
2026-09-21 18:36:31 +02:00
committed by Lillem4n
parent 98fffe31be
commit e0c82440b3
2 changed files with 44 additions and 2 deletions
+7 -2
View File
@@ -47,15 +47,20 @@ func namesAPass(t *testing.T, where, text string, declared, funcs map[string]boo
}
}
func sourceFiles(t *testing.T) (*token.FileSet, []*ast.File) {
func goFiles(t *testing.T) []string {
t.Helper()
pkg, err := build.ImportDir(".", 0)
if err != nil {
t.Fatalf("read the package directory: %v", err)
}
return pkg.GoFiles
}
func sourceFiles(t *testing.T) (*token.FileSet, []*ast.File) {
t.Helper()
fset := token.NewFileSet()
var files []*ast.File
for _, name := range pkg.GoFiles {
for _, name := range goFiles(t) {
f, err := parser.ParseFile(fset, name, nil, parser.ParseComments)
if err != nil {
t.Fatalf("parse %s: %v", name, err)