Skip to content

Commit 7bc7039

Browse files
panjf2000gopherbot
authored andcommitted
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 <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent a7f6da7 commit 7bc7039

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/syscall/mksyscall.pl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
my $libc = 0;
3434
my $tags = ""; # build tags
3535
my $newtags = ""; # new style build tags
36+
my $stdimports = 'import "unsafe"';
3637
my $extraimports = "";
3738

3839
if($ARGV[0] eq "-b32") {
@@ -390,6 +391,10 @@ ($)
390391
exit 1;
391392
}
392393

394+
if($extraimports ne "") {
395+
$stdimports .= "\n$extraimports";
396+
}
397+
393398
# TODO: this assumes tags are just simply comma separated. For now this is all the uses.
394399
$newtags = $tags =~ s/,/ && /r;
395400

@@ -401,8 +406,7 @@ ($)
401406
402407
package syscall
403408
404-
import "unsafe"
405-
$extraimports
409+
$stdimports
406410
407411
$text
408412
EOF

0 commit comments

Comments
 (0)