git: 0949b237bb90 - main - checkstyle9.pl: Add --github to output for github workflows

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 02 Feb 2024 05:54:58 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=0949b237bb901255cc418498b91edfe497131579

commit 0949b237bb901255cc418498b91edfe497131579
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-02-02 05:50:19 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-02 05:50:19 +0000

    checkstyle9.pl: Add --github to output for github workflows
    
    If you add "::error file=foo/bar.c:line=123:" before the error message,
    it will appear inline.
    
    Sponsored by:           Netflix
---
 tools/build/checkstyle9.pl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/build/checkstyle9.pl b/tools/build/checkstyle9.pl
index 8b30baa10fc9..8fe9b9f94da1 100755
--- a/tools/build/checkstyle9.pl
+++ b/tools/build/checkstyle9.pl
@@ -25,6 +25,7 @@ my $chk_patch = undef;
 my $chk_branch = undef;
 my $tst_only;
 my $emacs = 0;
+my $github = 0;
 my $terse = 0;
 my $file = undef;
 my $color = "auto";
@@ -91,6 +92,7 @@ GetOptions(
 	'patch!'	=> \$chk_patch,
 	'branch!'	=> \$chk_branch,
 	'emacs!'	=> \$emacs,
+	'github!'	=> \$github,
 	'terse!'	=> \$terse,
 	'f|file!'	=> \$file,
 	'strict!'	=> \$no_warnings,
@@ -1395,6 +1397,8 @@ sub process {
 #make up the handle for any error we report on this line
 		$prefix = "$filename:$realline: " if ($emacs && $file);
 		$prefix = "$filename:$linenr: " if ($emacs && !$file);
+		$prefix = "::error file=$filename:line=$realline:\:" if ($github && $file);
+		$prefix = "::error file=$realfile:line=$linenr:\:" if ($github && !$file);
 
 		$here = "#$linenr: " if (!$file);
 		$here = "#$realline: " if ($file);