This is an unusual change in that it exists solely to exercise generated
code and thus increase test coverage. On the one hand, if we never care
about the string value of type `RedirMode` then it should be removed
from the stringified types. On the other hand, verifying a redirection
is correctly represented in the output of the parse.pprint...() family
of functions is useful given the importance of I/O redirections in shells
like Elvish.
A Query is a sequence of compound expressions or pairs, like the arguments
and options in a command form. It is not used by any other node type, and is
intended to be a top-level node for representing a small DSL for filtering data,
such as the filter for history mode or location mode.
This addresses #1051.
As with commit #eb2a792 I acknowledge that `golint` recommendations are
controversial and should not automatically be acted on. Nonetheless,
this change fixes legitimate lint issues such as copy/paste cleanups,
style problems I introduced (`i += 1` versus `i++`) or method/var comments
that are not in the preferred form.
Most of the code uses keyed fields in composite literals; i.e., struct
literals. However, running `go vet ./...` reports a few places that use
anonymous fields. This modifies those composite literals to use keyed
fields. This does make the code a bit more verbose without reducing
the likelihood of a bug. But it does make the code more consistent, use
best practices, and make it easier to notice if a potential problem is
introduced when running `go vet ./...` since that command now produces
no diagnostic output.
I considered adding a `make vet` target that explicitly ran
go vet -composites=false ./...
I decided not to do that since consistently using keyed composite literals
is preferable to having a mix of keyed and unkeyed composite literals.
This also removes the unused `ExampleLoop` function which causes this
`go vet` warning:
pkg/cli/loop_test.go:130:1: ExampleLoop refers to unknown identifier: Loop
I stumbled across a comment that began with "XXX". It was clearly meant as
a "TODO" comment. This changes all such occurrences. However, a few "XXX"
comments are ambiguous and a better prefix might be "WARNING". The "TODO"
prefix at least ensures someone, eventually, looks into the situation
and either rewords the comment or fixes the problem. This change means
everyone can assume searching for "// TODO" will find all such comments
rather than requiring they also know to search for "// XXX".
This breaks the use of meta characters in names of user-defined functions. See
b.elv.sh/946 on how to resolve the inconsistency on the restrictions in variable
names.
This reverts commit 02f5433789.