mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/doc: truncate long lists of arguments
Some field-lists (especially in generated code) can be excessively long.
In the one-line printout, it does not make sense to print all elements
of the list if line-wrapping causes the "one-line" to become multi-line.
// Before:
var LongLine = newLongLine("someArgument1", "someArgument2", "someArgument3", "someArgument4", "someArgument5", "someArgument6", "someArgument7", "someArgument8")
// After:
var LongLine = newLongLine("someArgument1", "someArgument2", "someArgument3", "someArgument4", ...)
Change-Id: I4bbbe2dbd1d7be9f02d63431d213088c3dee332c
Reviewed-on: https://go-review.googlesource.com/36031
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
ea5529de15
commit
a1ea91219f
3 changed files with 35 additions and 7 deletions
|
|
@ -71,6 +71,7 @@ var tests = []test{
|
|||
`const MultiLineConst = ...`, // Multi line constant.
|
||||
`var MultiLineVar = map\[struct{ ... }\]struct{ ... }{ ... }`, // Multi line variable.
|
||||
`func MultiLineFunc\(x interface{ ... }\) \(r struct{ ... }\)`, // Multi line function.
|
||||
`var LongLine = newLongLine\(("someArgument[1-4]", ){4}...\)`, // Long list of arguments.
|
||||
`type T1 = T2`, // Type alias
|
||||
},
|
||||
[]string{
|
||||
|
|
@ -90,7 +91,8 @@ var tests = []test{
|
|||
`unexportedTypedConstant`, // No unexported typed constant.
|
||||
`Field`, // No fields.
|
||||
`Method`, // No methods.
|
||||
`type T1 T2`, // Type alias does not display as type declaration.
|
||||
`someArgument[5-8]`, // No truncated arguments.
|
||||
`type T1 T2`, // Type alias does not display as type declaration.
|
||||
},
|
||||
},
|
||||
// Package dump -u
|
||||
|
|
@ -270,7 +272,7 @@ var tests = []test{
|
|||
// Type T1 dump (alias).
|
||||
{
|
||||
"type T1",
|
||||
[]string{p+".T1"},
|
||||
[]string{p + ".T1"},
|
||||
[]string{
|
||||
`type T1 = T2`,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue