refactor: GenSummary return path

This commit is contained in:
lilong.129
2024-09-13 20:43:16 +08:00
parent e754fb41e1
commit f8c2c3c7fb
3 changed files with 9 additions and 9 deletions
+7 -7
View File
@@ -96,19 +96,19 @@ func (s *Summary) GenHTMLReport() error {
return err
}
func (s *Summary) GenSummary() error {
func (s *Summary) GenSummary() (path string, err error) {
reportsDir := filepath.Join(s.rootDir, env.ResultsDir)
err := builtin.EnsureFolderExists(reportsDir)
err = builtin.EnsureFolderExists(reportsDir)
if err != nil {
return err
return "", err
}
summaryPath := filepath.Join(reportsDir, "summary.json")
err = builtin.Dump2JSON(s, summaryPath)
path = filepath.Join(reportsDir, "summary.json")
err = builtin.Dump2JSON(s, path)
if err != nil {
return err
return "", err
}
return nil
return path, nil
}
//go:embed internal/scaffold/templates/report/template.html