Documentation
¶
Index ¶
- func AddHeader(filePath string, header string) error
- func AddLicenseFile(dirPath string, spdxID string) (string, error)
- func EnsureCorrectName(filePath string) (string, error)
- func FindLicenseFiles(dirPath string) ([]string, error)
- func HasCopyright(filePath string) (bool, error)
- func HasMatchingCopyright(filePath string, copyrightStatement string, caseSensitive bool) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHeader ¶
AddHeader prepends a given string to a file. It will automatically handle newline characters
func AddLicenseFile ¶
AddLicenseFile creates a file named "LICENSE" in the target directory pre-populated with license text based on the SPDX Identifier you supply. Returns the fully qualified path to the license file it created
NOTE: this function will NOT add a copyright statement for you. You must manually call AddHeader() afterward if you wish to have copyright headers
func EnsureCorrectName ¶
EnsureCorrectName fixes a malformed license file name and returns the new (corrected) file path E.g., "license.txt" --> "LICENSE"
func FindLicenseFiles ¶
FindLicenseFiles returns a list of filepaths for licenses in a given directory
func HasCopyright ¶
HasCopyright reports whether or not a file contains a copyright statement It makes no promises as to the validity of the copyright statement, however! If you wish to validate the contents of the statement, use hasValidCopyright
Types ¶
This section is empty.