1
0
mirror of https://github.com/golang/go synced 2024-11-12 10:20:27 -07:00

cmd/go: build test files containing non-runnable examples

Even if we can't run them, we should at least check that they compile.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/107320046
This commit is contained in:
Andrew Gerrand 2014-06-25 08:22:22 +10:00
parent 63e3763af8
commit eb4c3455de

View File

@ -1177,12 +1177,12 @@ func (t *testFuncs) load(filename, pkg string, seen *bool) error {
ex := doc.Examples(f)
sort.Sort(byOrder(ex))
for _, e := range ex {
*seen = true // Build the file even if the example is not runnable.
if e.Output == "" && !e.EmptyOutput {
// Don't run examples with no output.
continue
}
t.Examples = append(t.Examples, testFunc{pkg, "Example" + e.Name, e.Output})
*seen = true
}
return nil
}