dev
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 @@
package cmd
import (
+ "bufio"
"encoding/json"
"fmt"
"github.com/spf13/cobra"
@@ -23,6 +24,7 @@
"license-checker/util"
"os"
"path/filepath"
+ "strings"
)
var cfgFile string
@@ -39,7 +41,7 @@
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 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 @@
// 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