func Fix()

in pkg/header/fix.go [32:46]


func Fix(file string, config *ConfigHeader, result *Result) error {
	var r Result
	if err := CheckFile(file, config, &r); err != nil || !r.HasFailure() {
		logger.Log.Warnln("Try to fix a valid file, do nothing:", file)
		return err
	}

	style := comments.FileCommentStyle(file)

	if style == nil {
		return fmt.Errorf("unsupported file: %v", file)
	}

	return InsertComment(file, style, config, result)
}