envsubst -no-unset blows up on ${FOO:=}
- Dominant language
- Go
- Stars
- 907
- Forks
- 96
- PR merge metrics
- No merged PRs in 30d
Description
It seems that an empty default value is treated as if a default value has not been provided.
Expected:
```console
~ $ go install github.com/a8m/envsubst/cmd/envsubst@v1.4.2
~ $ go/bin/envsubst -no-unset <<< 'value: ${FOO:=}'
value:
~ $ echo $?
0
~ $
```
Got:
```console
~ $ go install github.com/a8m/envsubst/cmd/envsubst@v1.4.2
~ $ go/bin/envsubst -no-unset <<< 'value: ${FOO:=}'
variable ${FOO} not set
~ $ echo $?
1
~ $
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Look at the parsing logic for variable substitution in the source code, likely in a file like parse.go or subst.go. The bug is that ${FOO:=} with an empty default is incorrectly flagged as unset when -no-unset is used. Run the existing tests to see how defaults are handled, then add a test case for this scenario and fix the parsing to treat empty defaults as valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, shell
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100