${var:+FOO} mishandles empty vars
- Langage dominant
- Go
- Étoiles
- 907
- Forks
- 96
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
```console
$ export empty=''
$ echo '[${empty:+FOO}]' | envsubst
[FOO]
```
This is not what shell does:
```console
$ echo "[${empty:+FOO}]"
[]
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Look at the parsing and substitution logic in the Go source code, likely in a file like `envsubst.go` or `parser.go`. The issue demonstrates that the `${var:+FOO}` syntax incorrectly substitutes when the variable is set but empty. Compare the shell's behavior (Bash) to the current implementation. Write a test to reproduce the bug, then modify the substitution logic to handle empty strings correctly. Check for similar patterns like `${var:-FOO}` to ensure consistency.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- go, shell
- Domaine
- cli, tooling
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 55/100