docs: don't create docs file for empty packages

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-06-08 18:33:39 -07:00
parent 5537ab33de
commit 606398b69a
2 changed files with 6 additions and 6 deletions

View File

@ -327,12 +327,6 @@ func walkStdlib(ctx context.Context, output, format string) {
return err
}
f, err := os.Create(filepath)
if err != nil {
return err
}
defer f.Close()
pkg := fmt.Sprintf("dagger.io/%s", p)
lg.Info().Str("package", pkg).Str("format", format).Msg("generating doc")
val, err := loadCode(pkg)
@ -344,6 +338,12 @@ func walkStdlib(ctx context.Context, output, format string) {
return err
}
f, err := os.Create(filepath)
if err != nil {
return err
}
defer f.Close()
PrintDoc(ctx, f, pkg, val, format)
return nil
})