Conversation
@dnephin Can you confirm that the list of valid character is correct? It is now a-z, A-Z, _ and 0-9. |
|
testInterpolatedLine(t, "WORKED", "$lower", variables) | ||
testInterpolatedLine(t, "WORKED", "${MiXeD}", variables) | ||
testInterpolatedLine(t, "WORKED", "${split_VaLue}", variables) | ||
testInterpolatedLine(t, "WORKED", "$9aNumber", variables) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the python implementation this wouldn't work. I think the reason is that it's using the same logic as bash variables, which can't start with a number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I can make thing starting with a number not work, but an embedded number would be fine?
Signed-off-by: Darren Shepherd <darren@rancher.com>
88d50c8
to
e37a970
Compare
@dnephin Updated to not allow starting with a number |
Is this for env-vars? You may be interested in moby/moby#16608 (and the linked issue) |
@thaJeztah nope, not for env-vars, this is for variables in the compose file (it just happens we use very similar syntax). |
@@ -8,6 +8,17 @@ import ( | |||
"github.com/Sirupsen/logrus" | |||
) | |||
|
|||
func isNum(c uint8) bool { | |||
return c >= '0' && c <= '9' | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still kind of surprises me that there is no golang builtin for super common operations like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The joys of golang.
LGTM |
Support a-z and 0-9 in variable names
Signed-off-by: Darren Shepherd darren@rancher.com