Fix some minor errors (#36)
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 684f35a..afd8578 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -37,12 +37,11 @@
func (config *Config) Parse(file string) (err error) {
var bytes []byte
- if file != "" {
- logger.Log.Infoln("Loading configuration from file:", file)
+ // attempt to read configuration from specified file
+ logger.Log.Infoln("Loading configuration from file:", file)
- if bytes, err = os.ReadFile(file); err != nil && !os.IsNotExist(err) {
- return err
- }
+ if bytes, err = os.ReadFile(file); err != nil && !os.IsNotExist(err) {
+ return err
}
if os.IsNotExist(err) {
diff --git a/pkg/header/check.go b/pkg/header/check.go
index 21bdb8d..e10b318 100644
--- a/pkg/header/check.go
+++ b/pkg/header/check.go
@@ -45,7 +45,7 @@
var seen = make(map[string]bool)
func checkPattern(pattern string, result *Result, config *ConfigHeader) error {
- paths, err := doublestar.Glob(pattern)
+ paths, err := glob(pattern)
if err != nil {
return err
@@ -65,10 +65,22 @@
return nil
}
+func glob(pattern string) (matches []string, err error) {
+ if pattern == "." {
+ return doublestar.Glob("./")
+ }
+
+ return doublestar.Glob(pattern)
+}
+
func checkPath(path string, result *Result, config *ConfigHeader) error {
defer func() { seen[path] = true }()
- if yes, err := config.ShouldIgnore(path); yes || seen[path] || err != nil {
+ if seen[path] {
+ return nil
+ }
+
+ if yes, err := config.ShouldIgnore(path); yes || err != nil {
return err
}