func extractCopyrightNotices(path string, raw []byte, verbose bool, showNotice bool, copyrightTagger *tagger.Tagger) ([]byte, error) { if showNotice { log.Printf("[LIC %s]: found copyright outside of comments\n", path) } cindex := copyrightTagger.FindAllIndex(raw) if cindex == nil { return nil, fmt.Errorf("%s: matched a copyright but couldn't find it", path) } var ltext []byte for i := 0; i < len(cindex); i++ { start := cindex[i][0] end := cindex[i][1] if showNotice { log.Printf("[COPYRIGHT %s] %s\n", path, string(raw[start:end])) } ltext = append(ltext, raw[start:end]...) ltext = append(ltext, '\n') } return ltext, nil }