From: Andy Pan Date: Fri, 24 May 2024 02:07:54 +0000 (+0800) Subject: syscall: prevent redundant newline from empty $extraimports X-Git-Tag: go1.23rc1~139 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7bc7039a6a518ed43f6177763d584e354ebd4bd7;p=gostls13.git syscall: prevent redundant newline from empty $extraimports Currently mksyscall script produces one redundant newline when $extraimports is empty, leading to a gofmt warning reported by "git codereview change". Change-Id: I57b0fa040347375698973e777285deded16ab62e Reviewed-on: https://go-review.googlesource.com/c/go/+/587877 Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Carlos Amedee LUCI-TryBot-Result: Go LUCI --- diff --git a/src/syscall/mksyscall.pl b/src/syscall/mksyscall.pl index 47efbffcbc..b46a3f9438 100755 --- a/src/syscall/mksyscall.pl +++ b/src/syscall/mksyscall.pl @@ -33,6 +33,7 @@ my $arm = 0; # 64-bit value should use (even, odd)-pair my $libc = 0; my $tags = ""; # build tags my $newtags = ""; # new style build tags +my $stdimports = 'import "unsafe"'; my $extraimports = ""; if($ARGV[0] eq "-b32") { @@ -390,6 +391,10 @@ if($errors) { exit 1; } +if($extraimports ne "") { + $stdimports .= "\n$extraimports"; +} + # TODO: this assumes tags are just simply comma separated. For now this is all the uses. $newtags = $tags =~ s/,/ && /r; @@ -401,8 +406,7 @@ print <