From: Dmitri Shuralyov Date: Thu, 1 Jun 2023 21:55:06 +0000 (-0400) Subject: cmd/api: make check even pickier about api/next/*.txt X-Git-Tag: go1.21rc1~118 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0a68767864f622c5b4334a6369f611446e64d4ae;p=gostls13.git cmd/api: make check even pickier about api/next/*.txt As spotted in CL 499981, 3 out of 51 of the api/next/*.txt files ended up with a blank line at the end. It's possible it would've been more if human reviewers didn't catch them. Since there's no formatter for these files, the only way to help catch things is to make the check pickier (as done in CL 431335). It can be loosened to let in useful blank lines if needed in the future. Change-Id: Iae7ee8e782b32707c576150914539ac4cc0faec4 Reviewed-on: https://go-review.googlesource.com/c/go/+/500115 Reviewed-by: Michael Knyszek TryBot-Result: Gopher Robot Auto-Submit: Dmitri Shuralyov Run-TryBot: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov --- diff --git a/src/cmd/api/api.go b/src/cmd/api/api.go index 376dc53fdc..b07f5db9d4 100644 --- a/src/cmd/api/api.go +++ b/src/cmd/api/api.go @@ -300,6 +300,13 @@ func fileFeatures(filename string, needApproval bool) []string { log.Printf("%s: contains CRLFs", filename) exitCode = 1 } + if filepath.Base(filename) == "go1.4.txt" { + // No use for blank lines in api files, except go1.4.txt + // used them in a reasonable way and we should let it be. + } else if strings.HasPrefix(s, "\n") || strings.Contains(s, "\n\n") { + log.Printf("%s: contains a blank line", filename) + exitCode = 1 + } if s == "" { log.Printf("%s: empty file", filename) exitCode = 1