You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by ke...@apache.org on 2020/12/21 07:57:38 UTC

[skywalking-eyes] 04/25: dev

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

kezhenxu94 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git

commit b17d8dbfa1759d76515f317fa0d912e6c3791570
Author: Hoshea <fg...@gmail.com>
AuthorDate: Sat Nov 21 23:08:12 2020 +0800

    dev
---
 cmd/root.go | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/cmd/root.go b/cmd/root.go
index 841fa46..d030d02 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -16,6 +16,7 @@ limitations under the License.
 package cmd
 
 import (
+	"bufio"
 	"encoding/json"
 	"fmt"
 	"github.com/spf13/cobra"
@@ -23,6 +24,7 @@ import (
 	"license-checker/util"
 	"os"
 	"path/filepath"
+	"strings"
 )
 
 var cfgFile string
@@ -39,7 +41,7 @@ if the specified files have the license header in the config file.`,
 		if err != nil {
 			fmt.Println(err)
 		}
-		//fmt.Println(config.TargetFiles)
+
 		if err := Walk(checkPath, config); err != nil {
 			fmt.Println(err)
 		}
@@ -99,6 +101,13 @@ func LoadConfig() (*Config, error) {
 }
 
 func Walk(p string, cfg *Config) error {
+	var license []string
+	if loose {
+		license = cfg.LicenseStrict
+	} else {
+		license = cfg.LicenseLoose
+	}
+
 	inExcludeDir := util.InStrSliceMapKeyFunc(cfg.Exclude.Directories)
 	inExcludeExt := util.InStrSliceMapKeyFunc(cfg.Exclude.Extensions)
 	inExcludeFiles := util.InStrSliceMapKeyFunc(cfg.Exclude.Files)
@@ -121,8 +130,19 @@ func Walk(p string, cfg *Config) error {
 
 			// TODO: open the file and check
 			fmt.Println(path)
-			//curDir := strings.Replace(path, fi.Name(), "", 1)
-			//fmt.Println(curDir)
+
+			file, err := os.Open(path)
+			if err != nil {
+				return err
+			}
+			defer file.Close()
+
+			scanner := bufio.NewScanner(file)
+			for scanner.Scan() {
+				line := scanner.Text()
+				if strings.Contains()
+			}
+
 		}
 
 		return nil