-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go1.7.1
Currently, in order to figure out whether a go/ast.CallExpr
refers to a variadic function call, the only option is to check whether the Ellipsis
field refers to a valid position. In fact, searching for Ellipsis.IsValid
reveals 10 locations in the standard library in which this approach is taken to checking whether a function call is variadic. This is a tad verbose, but worse, its meaning is non-obvious to someone not intimately familiar with the go/ast
package.
Instead, I propose that it would be nice if there were a convenience method on CallExpr
, IsVariadic
:
func (x *CallExpr) IsVariadic() bool {
return x.Ellipsis.IsValid()
}