go.tools/present: correctly test empty argument

Updates golang/go#7613.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/105130046
This commit is contained in:
Robert Daniel Kortschak 2014-06-12 16:54:10 -07:00 committed by Rob Pike
parent 53915e22e2
commit 6251f07ecd

View File

@ -239,7 +239,11 @@ func parseArgs(name string, line int, args []string) (res []interface{}, err err
case '$':
res[i] = "$"
case '_':
// Do nothing; '_' indicates an intentionally empty parameter.
if len(v) == 1 {
// Do nothing; "_" indicates an intentionally empty parameter.
break
}
fallthrough
default:
return nil, fmt.Errorf("%s:%d bad code argument %q", name, line, v)
}