Can I get the original value if variable empty
- 主要言語
- Go
- スター
- 907
- フォーク
- 96
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Hi, I need to know if there is a variable in my text that is empty after expanding it. I need those variables not to expand and use the original string.
```golang
os.Setenv("GREETINGS", "hello")
value := "$GREETINGS $NAME"
result, err := envsubst.String(value)
if err != nil {
return "", fmt.Errorf("error expanding environment on '%s': %s", value, err.Error())
}
fmt.Println(result) // The output is: "hello "
```
Is there a way of getting `hello $NAME` as the output?
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Look at the envsubst package's substitution logic, likely in the main source file. Understand how variables are expanded and where empty ones are handled. The goal is to modify the behavior so that undefined variables remain as their original string (e.g., $NAME) instead of being replaced with an empty string. Check existing tests to see how edge cases are handled and add a test for this new behavior.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- go
- 領域
- cli, tooling
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100