Skip to content

Commit 39b264a

Browse files
committed
refactor: split up package boundaries
1 parent bdf9c5f commit 39b264a

File tree

2 files changed

+39
-35
lines changed

2 files changed

+39
-35
lines changed

scripts/validate-contributor-readmes/main.go renamed to scripts/contributors/contributors.go

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
// This package is for validating all contributors within the main Registry
2-
// directory. It validates that it has nothing but sub-directories, and that
3-
// each sub-directory has a README.md file. Each of those files must then
4-
// describe a specific contributor. The contents of these files will be parsed
5-
// by the Registry site build step, to be displayed in the Registry site's UI.
61
package main
72

83
import (
94
"bufio"
105
"errors"
116
"fmt"
12-
"log"
137
"net/url"
148
"os"
159
"path"
@@ -449,32 +443,3 @@ func validateRelativeUrls(
449443
errors: problems,
450444
}
451445
}
452-
453-
func main() {
454-
log.Println("Starting README validation")
455-
allReadmeFiles, err := aggregateContributorReadmeFiles()
456-
if err != nil {
457-
log.Panic(err)
458-
}
459-
460-
log.Printf("Processing %d README files\n", len(allReadmeFiles))
461-
contributors, err := parseContributorFiles(allReadmeFiles)
462-
if err != nil {
463-
log.Panic(err)
464-
}
465-
log.Printf(
466-
"Processed %d README files as valid contributor profiles",
467-
len(contributors),
468-
)
469-
470-
err = validateRelativeUrls(contributors)
471-
if err != nil {
472-
log.Panic(err)
473-
}
474-
log.Println("All relative URLs for READMEs are valid")
475-
476-
log.Printf(
477-
"Processed all READMEs in the %q directory\n",
478-
rootRegistryPath,
479-
)
480-
}

scripts/contributors/main.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// This package is for validating all contributors within the main Registry
2+
// directory. It validates that it has nothing but sub-directories, and that
3+
// each sub-directory has a README.md file. Each of those files must then
4+
// describe a specific contributor. The contents of these files will be parsed
5+
// by the Registry site build step, to be displayed in the Registry site's UI.
6+
package main
7+
8+
import (
9+
"log"
10+
)
11+
12+
func main() {
13+
log.Println("Starting README validation")
14+
allReadmeFiles, err := aggregateContributorReadmeFiles()
15+
if err != nil {
16+
log.Panic(err)
17+
}
18+
19+
log.Printf("Processing %d README files\n", len(allReadmeFiles))
20+
contributors, err := parseContributorFiles(allReadmeFiles)
21+
log.Printf(
22+
"Processed %d README files as valid contributor profiles",
23+
len(contributors),
24+
)
25+
if err != nil {
26+
log.Panic(err)
27+
}
28+
29+
err = validateRelativeUrls(contributors)
30+
if err != nil {
31+
log.Panic(err)
32+
}
33+
log.Println("All relative URLs for READMEs are valid")
34+
35+
log.Printf(
36+
"Processed all READMEs in the %q directory\n",
37+
rootRegistryPath,
38+
)
39+
}

0 commit comments

Comments
 (0)