ryanuber / go-license

Software licensing standardization library for Golang
MIT License
69 stars 15 forks source link

Add ".rst" suffix to the pile #11

Open client9 opened 9 years ago

client9 commented 9 years ago

https://en.wikipedia.org/wiki/ReStructuredText

https://www.google.com/search?client=safari&rls=en&q=site:github.com+copyleft&ie=UTF-8&oe=UTF-8#q=site:github.com+license.rst

site:github.com copying.st

etc

client9 commented 9 years ago

https://www.google.com/search?client=safari&rls=en&q=site:github.com+license.rtf&ie=UTF-8&oe=UTF-8

etc.

client9 commented 9 years ago

FWIW, In another project, I just ignore the filename suffix to produce a list of candidates.

Seems to be ok.

// LicenseFilePrefix is a list of filename prefixes that indicate it
//  might contain a software license
var LicenseFilePrefix = []string{
        "license",
        "copying",
        "unlicensed",
//Mine has "copyright" and "copyleft" too
}

// IsPossibleLicenseFile returns true if the filename might be contain a software license
func IsPossibleLicenseFile(filename string) bool {
        lowerfile := strings.ToLower(filename)
        for _, prefix := range LicenseFilePrefix {
                if strings.HasPrefix(lowerfile, prefix) {
                        return true
                }
        }
        return false
}