func (c Copyright) processFile(action Action, noticeBody, path string, info os.FileInfo) error {
	fileExtension := filepath.Ext(path)
	noticeTemplate, ok := c.noticeTemplateByExtension(fileExtension)
	if !ok {
		return fmt.Errorf("invalid copyright injection file; %s", filepath.Base(path))
	}
	notice, err := c.compileNoticeTemplate(noticeTemplate, noticeBody)
	if err != nil {
		return err
	}
	fileContents, err := ioutil.ReadFile(path)
	if err != nil {
		return err
	}
	return action(path, info, fileContents, []byte(notice))
}
// processFile processes a single file with the action
processFile processes a single file with the action
// processFile processes a single file with the action
func (c Copyright) processFile(action Action, noticeBody, path string, info os.FileInfo) error {
	fileExtension := filepath.Ext(path)
	noticeTemplate, ok := c.noticeTemplateByExtension(fileExtension)
	if !ok {
		return fmt.Errorf("invalid copyright injection file; %s", filepath.Base(path))
	}
	notice, err := c.compileNoticeTemplate(noticeTemplate, noticeBody)
	if err != nil {
		return err
	}
	fileContents, err := ioutil.ReadFile(path)
	if err != nil {
		return err
	}
	return action(path, info, fileContents, []byte(notice))
}
func ( c Copyright ) processFile ( action Action , noticeBody , path string , info os . FileInfo ) error { fileExtension := filepath . Ext ( path ) noticeTemplate , ok := c . noticeTemplateByExtension ( fileExtension ) if ! ok { return fmt . Errorf ( " " , filepath . Base ( path ) ) } notice , err := c . compileNoticeTemplate ( noticeTemplate , noticeBody ) if err != nil { return err } fileContents , err := ioutil . ReadFile ( path ) if err != nil { return err } return action ( path , info , fileContents , [ ] byte ( notice ) ) }
processFile processes a single file with the action
processFile processes a single file with the action