Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| 02c900326c |
1 changed files with 16 additions and 6 deletions
22
main.go
22
main.go
|
|
@ -49,7 +49,7 @@ var (
|
||||||
lics []license
|
lics []license
|
||||||
errFound = errors.New("file found")
|
errFound = errors.New("file found")
|
||||||
licre = regexp.MustCompile("([Ll][Ii][Cc][Ee][Nn][Ss][Ee].*)")
|
licre = regexp.MustCompile("([Ll][Ii][Cc][Ee][Nn][Ss][Ee].*)")
|
||||||
pathre = regexp.MustCompile("vendor/(.*/(.*/.*))/")
|
pathre = regexp.MustCompile("vendor/(.*/(.*/.*))/|vendor/(.*/.*/)")
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
@ -120,11 +120,21 @@ func walker(path string, info os.FileInfo, err error) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
match := pathre.FindAllStringSubmatch(path, -1)
|
match := pathre.FindAllStringSubmatch(path, -1)
|
||||||
lics = append(lics, license{
|
if len(match) >= 1 {
|
||||||
Path: match[0][2],
|
if len(match[0]) >= 4 {
|
||||||
URL: match[0][1],
|
if match[0][1] == "" {
|
||||||
Text: string(text),
|
match[0][1] = match[0][3]
|
||||||
})
|
match[0][2] = match[0][3]
|
||||||
|
}
|
||||||
|
lics = append(lics, license{
|
||||||
|
Path: match[0][2],
|
||||||
|
URL: match[0][1],
|
||||||
|
Text: string(text),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return errFound
|
return errFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue