@@ -24,7 +24,7 @@ Usage: go run ci.go <command> <command flags/arguments>
24
24
Available commands are:
25
25
26
26
install [-arch architecture] [ packages... ] -- builds packages and executables
27
- test [ -coverage ] [ -vet ] [ -misspell] [ packages... ] -- runs the tests
27
+ test [ -coverage ] [ -vet ] [ -misspell ] [ packages... ] -- runs the tests
28
28
archive [-arch architecture] [ -type zip|tar ] [ -signer key-envvar ] [ -upload dest ] -- archives build artefacts
29
29
importkeys -- imports signing keys from env
30
30
debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
@@ -289,29 +289,7 @@ func doTest(cmdline []string) {
289
289
build .MustRun (goTool ("vet" , packages ... ))
290
290
}
291
291
if * misspell {
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
296
- for _ , pkg := range packages {
297
- // The spell checker doesn't work on packages, gather all .go files for it
298
- out , err := goTool ("list" , "-f" , "{{.Dir}}{{range .GoFiles}}\n {{.}}{{end}}{{range .CgoFiles}}\n {{.}}{{end}}{{range .TestGoFiles}}\n {{.}}{{end}}" , pkg ).CombinedOutput ()
299
- if err != nil {
300
- log .Fatalf ("source file listing failed: %v\n %s" , err , string (out ))
301
- }
302
- // Retrieve the folder and assemble the source list
303
- lines := strings .Split (string (out ), "\n " )
304
- root := lines [0 ]
305
-
306
- sources := make ([]string , 0 , len (lines )- 1 )
307
- for _ , line := range lines [1 :] {
308
- if line = strings .TrimSpace (line ); line != "" {
309
- sources = append (sources , filepath .Join (root , line ))
310
- }
311
- }
312
- // Run the spell checker for this particular package
313
- build .MustRunCommand (filepath .Join (GOBIN , "misspell" ), append ([]string {"-error" }, sources ... )... )
314
- }
292
+ spellcheck (packages )
315
293
}
316
294
// Run the actual tests.
317
295
gotest := goTool ("test" )
@@ -325,6 +303,34 @@ func doTest(cmdline []string) {
325
303
build .MustRun (gotest )
326
304
}
327
305
306
+ // spellcheck runs the client9/misspell spellchecker package on all Go, Cgo and
307
+ // test files in the requested packages.
308
+ func spellcheck (packages []string ) {
309
+ // Ensure the spellchecker is available
310
+ build .MustRun (goTool ("get" , "github.com/client9/misspell/cmd/misspell" ))
311
+
312
+ // Windows chokes on long argument lists, check packages individualy
313
+ for _ , pkg := range packages {
314
+ // The spell checker doesn't work on packages, gather all .go files for it
315
+ out , err := goTool ("list" , "-f" , "{{.Dir}}{{range .GoFiles}}\n {{.}}{{end}}{{range .CgoFiles}}\n {{.}}{{end}}{{range .TestGoFiles}}\n {{.}}{{end}}" , pkg ).CombinedOutput ()
316
+ if err != nil {
317
+ log .Fatalf ("source file listing failed: %v\n %s" , err , string (out ))
318
+ }
319
+ // Retrieve the folder and assemble the source list
320
+ lines := strings .Split (string (out ), "\n " )
321
+ root := lines [0 ]
322
+
323
+ sources := make ([]string , 0 , len (lines )- 1 )
324
+ for _ , line := range lines [1 :] {
325
+ if line = strings .TrimSpace (line ); line != "" {
326
+ sources = append (sources , filepath .Join (root , line ))
327
+ }
328
+ }
329
+ // Run the spell checker for this particular package
330
+ build .MustRunCommand (filepath .Join (GOBIN , "misspell" ), append ([]string {"-error" }, sources ... )... )
331
+ }
332
+ }
333
+
328
334
// Release Packaging
329
335
330
336
func doArchive (cmdline []string ) {
0 commit comments