]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/api: make check even pickier about api/next/*.txt
authorDmitri Shuralyov <dmitshur@golang.org>
Thu, 1 Jun 2023 21:55:06 +0000 (17:55 -0400)
committerGopher Robot <gobot@golang.org>
Fri, 2 Jun 2023 16:04:40 +0000 (16:04 +0000)
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 <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/cmd/api/api.go

index 376dc53fdcf6da786c062a76be7f9c27826bebc5..b07f5db9d40b1319c5b32c0ade9c75ac1009d564 100644 (file)
@@ -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