]> Cypherpunks repositories - gostls13.git/commit
go/printer: forbid empty line before first comment in block
authorJoe Tsai <joetsai@digital-static.net>
Fri, 20 Oct 2017 00:31:31 +0000 (17:31 -0700)
committerJoe Tsai <joetsai@google.com>
Thu, 2 Nov 2017 18:17:22 +0000 (18:17 +0000)
commit08f19bbde1b01227fdc2fa2d326e4029bb74dd96
tree47677662e92d111529f1f66d9731bf35c18b6bd0
parent8585f9fdb176893992bc8096ff595148b14b1795
go/printer: forbid empty line before first comment in block

To improve readability when exported fields are removed,
forbid the printer from emitting an empty line before the first comment
in a const, var, or type block.
Also, when printing the "Has filtered or unexported fields." message,
add an empty line before it to separate the message from the struct
or interfact contents.

Before the change:
<<<
type NamedArg struct {

        // Name is the name of the parameter placeholder.
        //
        // If empty, the ordinal position in the argument list will be
        // used.
        //
        // Name must omit any symbol prefix.
        Name string

        // Value is the value of the parameter.
        // It may be assigned the same value types as the query
        // arguments.
        Value interface{}
        // contains filtered or unexported fields
}
>>>

After the change:
<<<
type NamedArg struct {
        // Name is the name of the parameter placeholder.
        //
        // If empty, the ordinal position in the argument list will be
        // used.
        //
        // Name must omit any symbol prefix.
        Name string

        // Value is the value of the parameter.
        // It may be assigned the same value types as the query
        // arguments.
        Value interface{}

        // contains filtered or unexported fields
}
>>>

Fixes #18264

Change-Id: I9fe17ca39cf92fcdfea55064bd2eaa784ce48c88
Reviewed-on: https://go-review.googlesource.com/71990
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
30 files changed:
misc/cgo/test/buildid_linux.go
src/cmd/compile/internal/ssa/gen/rulegen.go
src/cmd/internal/obj/ppc64/asm9.go
src/cmd/internal/obj/x86/asm6.go
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ppc64/asm.go
src/encoding/base32/base32.go
src/go/doc/testdata/blank.0.golden
src/go/doc/testdata/blank.2.golden
src/go/doc/testdata/testing.0.golden
src/go/doc/testdata/testing.2.golden
src/go/printer/nodes.go
src/go/printer/printer.go
src/go/printer/testdata/comments.golden
src/go/printer/testdata/comments.input
src/go/printer/testdata/comments.x
src/hash/crc32/crc32_ppc64le.go
src/image/internal/imageutil/impl.go
src/net/http/httputil/dump_test.go
src/net/http/httputil/persist.go
src/net/http/internal/chunked.go
src/net/http/requestwrite_test.go
src/net/http/server.go
src/net/mail/message_test.go
src/regexp/syntax/parse.go
src/runtime/symtab.go
src/syscall/syscall_netbsd.go
src/syscall/syscall_openbsd.go
src/time/sleep_test.go
src/unicode/example_test.go