func readLicenseFromSpdx()

in pkg/header/config.go [199:214]


func readLicenseFromSpdx(config *ConfigHeader) (string, error) {
	spdxID, owner := config.License.SpdxID, config.License.CopyrightOwner
	filename := fmt.Sprintf("header-templates/%v.txt", spdxID)

	if spdxID == "Apache-2.0" && ASFNames.MatchString(owner) {
		// Note that the Apache Software Foundation uses a different source header that is related to our use of a CLA.
		// Our instructions for our project's source headers are here (https://www.apache.org/legal/src-headers.html#headers).
		filename = "header-templates/Apache-2.0-ASF.txt"
	}

	content, err := assets.Asset(filename)
	if err != nil {
		return "", fmt.Errorf("failed to find a license template for spdx id %v, %w", spdxID, err)
	}
	return string(content), nil
}