You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by he...@apache.org on 2023/06/23 20:57:11 UTC

[incubator-devlake] branch main updated: fix: added missing err check to table_info_checker (#5557)

This is an automated email from the ASF dual-hosted git repository.

hez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new d3bc54ba5 fix: added missing err check to table_info_checker (#5557)
d3bc54ba5 is described below

commit d3bc54ba5fe671460a185699a43708d8a6b4922c
Author: Keon Amini <ke...@merico.dev>
AuthorDate: Fri Jun 23 15:57:06 2023 -0500

    fix: added missing err check to table_info_checker (#5557)
---
 backend/core/utils/table_info_checker.go | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/backend/core/utils/table_info_checker.go b/backend/core/utils/table_info_checker.go
index 049961eaf..99cde19db 100644
--- a/backend/core/utils/table_info_checker.go
+++ b/backend/core/utils/table_info_checker.go
@@ -115,7 +115,16 @@ func (checker *TableInfoChecker) parseDirRecursively(modelsDir string, additiona
 	packagesMap := make(map[string]*ast.Package)
 	ignorablePackages := append(checker.ignoredPackages, additionalIgnorablePackages...)
 	err := filepath.WalkDir(modelsDir, func(path string, d fs2.DirEntry, err error) error {
+		if err != nil {
+			return err
+		}
+		if !d.IsDir() {
+			return nil
+		}
 		packs, err := parser.ParseDir(token.NewFileSet(), path, nil, 0)
+		if err != nil {
+			return err
+		}
 		for packageName, packageObj := range packs {
 			if slices.Contains(ignorablePackages, packageName) {
 				return fs2.SkipDir
@@ -171,6 +180,9 @@ func (checker *TableInfoChecker) ensureCoverage() errors.Error {
 			return fs2.SkipDir
 		}
 		packs, err := parser.ParseDir(token.NewFileSet(), path, nil, parser.PackageClauseOnly)
+		if err != nil {
+			return err
+		}
 		for _, pk := range packs {
 			if pk.Name == "main" {
 				packagesFound++