Skip to content

Commit a2bc90d

Browse files
committed
build: spellcheck individual packages (Windows path limits)
1 parent c01f8c3 commit a2bc90d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

build/ci.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -289,27 +289,29 @@ func doTest(cmdline []string) {
289289
build.MustRun(goTool("vet", packages...))
290290
}
291291
if *misspell {
292-
// The spell checker doesn't work on packages, gather all .go files for it
293-
sources := []string{}
292+
// Ensure the spellchecker is available
293+
build.MustRun(goTool("get", "github.com/client9/misspell/cmd/misspell"))
294+
295+
// Windows (AppVeyor) chokes on long argument lists, check packages individualy
294296
for _, pkg := range packages {
295-
// Gather all the source files of the package
297+
// The spell checker doesn't work on packages, gather all .go files for it
296298
out, err := goTool("list", "-f", "{{.Dir}}{{range .GoFiles}}\n{{.}}{{end}}{{range .CgoFiles}}\n{{.}}{{end}}{{range .TestGoFiles}}\n{{.}}{{end}}", pkg).CombinedOutput()
297299
if err != nil {
298300
log.Fatalf("source file listing failed: %v\n%s", err, string(out))
299301
}
300302
// Retrieve the folder and assemble the source list
301303
lines := strings.Split(string(out), "\n")
302-
303304
root := lines[0]
305+
306+
sources := make([]string, 0, len(lines)-1)
304307
for _, line := range lines[1:] {
305308
if line = strings.TrimSpace(line); line != "" {
306309
sources = append(sources, filepath.Join(root, line))
307310
}
308311
}
312+
// Run the spell checker for this particular package
313+
build.MustRunCommand(filepath.Join(GOBIN, "misspell"), append([]string{"-error"}, sources...)...)
309314
}
310-
// Download the spell checker tool and run on all source files
311-
build.MustRun(goTool("get", "github.com/client9/misspell/cmd/misspell"))
312-
build.MustRunCommand(filepath.Join(GOBIN, "misspell"), append([]string{"-error"}, sources...)...)
313315
}
314316
// Run the actual tests.
315317
gotest := goTool("test")

0 commit comments

Comments
 (0)