Closed anthony-zh closed 57 minutes ago
Variable names can not begin with a number, so the parser will believe they are numbers and raise the error you have noticed. If those variables are defined in your environment, and you need to access them, you can wrap in $env, like $env["1greet"].
@mdmcconnell is right. Use $env:
$env["1greet"]
env := map[string]interface{}{ "1greet": "Hello, %v!", "names": []string{"world", "you"}, "sprintf": fmt.Sprintf, }
=== RUN TestExpr2 --- FAIL: TestExpr2 (0.00s) panic: bad number syntax: "1g" (1:10) | sprintf(1greet, names[0]) | .........^ [recovered] panic: bad number syntax: "1g" (1:10) | sprintf(1greet, names[0]) | .........^