async function main() {
  const errors = [];

  const conformanceProto =
      (await fs.readFile(
           path.relative(`${__dirname}/..`, CONFORMANCE_PROTO_PATH), 'utf8'))
          .split('\n');
  errors.push(...ClosureOSSChecker.hasOnlyClosurePathsInConformance(
      CONFORMANCE_PROTO_PATH, conformanceProto));

  for await (const {filePath, contents} of yieldClosureFiles()) {
    // We check that there are no Google copyrights in every file except this
    // one, because the regex used to match for it (GOOGLE_COPYRIGHT_REGEX)
    // matches its own string representation.
    const isThisFile = filePath === path.relative(REPOSITORY_PATH, __filename);
    if (!isThisFile) {
      errors.push(
          ...ClosureOSSChecker.omitsGoogleCopyright(filePath, contents));
    }

    if (DOC_FILE_REGEX.test(filePath)) {
      errors.push(...ClosureOSSChecker.mentionsCCBYLicense(filePath, contents));
    } else if (!filePath.startsWith('doc/')) {
      errors.push(...ClosureOSSChecker.mentionsApache(filePath, contents));
      errors.push(...ClosureOSSChecker.hasClosureCopyright(filePath, contents));
    }
  }

  if (errors.length > 0) {
    console.error(errors.join('\n'));
    return 1;
  }
  console.error('All checks pass');
  return 0;
}
Checks that open-sourced files in this repository satisfy licensing and file
reference checks.
@return {!Promise<number>} The exit code.