Include escaped interpolations in identifiers #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
a reopening of #9 against main, #9 was helpfully auto-closed by github when its base branch,
master
, was deleted. sigh.original description follows
It's useful for consumers of this libary to be able to know if their input contains things that would be interpolated, and if so, which things. Currently, this is handled by the
interpolate.Identifiers()
function, which returns a list of the interpolate-able identifiers thatinterpolate.Interpolate()
would replace.However, this library makes one further modification to its input: when escaped expansions are included (ie,
$$MY_VAR
or\$MY_VAR
), they're de-escaped in the output. This is working as intended, but theinterpolate.Identifiers
function doesn't include these escaped interpolations, which is a bit confusing when you're using theIdentifiers
function to determine "will running Interpolate() change the input?"To remedy this, this PR updates the parse to handle escaped interpolations a bit differently, and treat them as a kind of expansion that doesn't take any input, and de-escapes its input. There's no functionality change, but escaped interpolations now show up in the
Identifiers()
functionThis PR also does a little bit of housekeeping - adding a buildkite pipeline, specifying the go version in the go.mod file, etc. Once it's merged, i'll make a release so that we can version this using go modules.