You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2022/10/08 04:22:40 UTC

[incubator-devlake] branch main updated: fix: nil check on the extractor (#3311)

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

klesh 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 356c2989 fix: nil check on the extractor (#3311)
356c2989 is described below

commit 356c2989549db5fa1fdf42e918296322cd0a4efe
Author: Shubham Gupta <69...@users.noreply.github.com>
AuthorDate: Sat Oct 8 09:52:36 2022 +0530

    fix: nil check on the extractor (#3311)
---
 generator/cmd/create_collector.go | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/generator/cmd/create_collector.go b/generator/cmd/create_collector.go
index 96cbe9b7..0fd0251a 100644
--- a/generator/cmd/create_collector.go
+++ b/generator/cmd/create_collector.go
@@ -19,15 +19,16 @@ package cmd
 
 import (
 	"fmt"
+	"os"
+	"path/filepath"
+	"regexp"
+	"strings"
+
 	"github.com/apache/incubator-devlake/errors"
 	"github.com/apache/incubator-devlake/generator/util"
 	"github.com/manifoldco/promptui"
 	"github.com/spf13/cobra"
 	"github.com/stoewer/go-strcase"
-	"os"
-	"path/filepath"
-	"regexp"
-	"strings"
 )
 
 func init() {
@@ -61,7 +62,10 @@ func collectorNameExistValidateHoc(pluginName string) promptui.ValidateFunc {
 			return errors.Default.New("please input which data would you will collect (snake_format)")
 		}
 		_, err := os.Stat(filepath.Join(`plugins`, pluginName, `tasks`, input+`_collector.go`))
-		return errors.Default.Wrap(err, "error getting collector src file")
+		if err != nil {
+			return errors.Default.Wrap(err, "error getting collector src file")
+		}
+		return nil
 	}
 	return collectorNameValidate
 }