mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-23 22:25:42 +00:00
Better error handling will empty env
This commit is contained in:
parent
a0e1f65b20
commit
69386316f3
@ -1,4 +1,4 @@
|
|||||||
Use the `documentIndex` operator to select nodes of a particular document.
|
Use the `documentIndex` operator (or the `di` shorthand) to select nodes of a particular document.
|
||||||
## Retrieve a document index
|
## Retrieve a document index
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
|
@ -2,6 +2,7 @@ package yqlib
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"container/list"
|
"container/list"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -27,6 +28,8 @@ func EnvOperator(d *dataTreeNavigator, matchMap *list.List, pathNode *PathTreeNo
|
|||||||
Tag: "!!str",
|
Tag: "!!str",
|
||||||
Value: rawValue,
|
Value: rawValue,
|
||||||
}
|
}
|
||||||
|
} else if rawValue == "" {
|
||||||
|
return nil, fmt.Errorf("Value for env variable '%v' not provided in env()", envName)
|
||||||
} else {
|
} else {
|
||||||
var dataBucket yaml.Node
|
var dataBucket yaml.Node
|
||||||
decoder := yaml.NewDecoder(strings.NewReader(rawValue))
|
decoder := yaml.NewDecoder(strings.NewReader(rawValue))
|
||||||
|
Loading…
Reference in New Issue
Block a user