Report unused variables.

This commit is contained in:
Jeffrey Regan
2019-02-26 17:19:24 -08:00
committed by jregan
parent b7e8042a02
commit ff6cd3ca55
6 changed files with 167 additions and 36 deletions

View File

@@ -36,11 +36,14 @@ func syntaxWrap(input string) string {
// implements the expansion semantics defined in the expansion spec; it
// returns the input string wrapped in the expansion syntax if no mapping
// for the input is found.
func MappingFuncFor(context ...map[string]string) func(string) string {
func MappingFuncFor(
counts map[string]int,
context ...map[string]string) func(string) string {
return func(input string) string {
for _, vars := range context {
val, ok := vars[input]
if ok {
counts[input]++
return val
}
}