|
1 | 1 | package structtrie |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "errors" |
4 | 5 | "fmt" |
5 | 6 |
|
6 | 7 | "github.com/databricks/cli/libs/structs/structpath" |
@@ -73,7 +74,7 @@ func NewFromMap(values map[string]any) (*Node, error) { |
73 | 74 | // A nil path represents the root node. |
74 | 75 | func Insert(root *Node, path *structpath.PathNode, value any) (*Node, error) { |
75 | 76 | if root == nil { |
76 | | - return nil, fmt.Errorf("root cannot be nil") |
| 77 | + return nil, errors.New("root cannot be nil") |
77 | 78 | } |
78 | 79 |
|
79 | 80 | if path == nil { |
@@ -258,19 +259,19 @@ var wildcardComponent = componentKey{kind: componentKindWildcard} |
258 | 259 |
|
259 | 260 | func componentFromPattern(node *structpath.PathNode) (componentKey, error) { |
260 | 261 | if node == nil { |
261 | | - return componentKey{}, fmt.Errorf("nil path node") |
| 262 | + return componentKey{}, errors.New("nil path node") |
262 | 263 | } |
263 | 264 |
|
264 | 265 | if node.DotStar() || node.BracketStar() { |
265 | 266 | return wildcardComponent, nil |
266 | 267 | } |
267 | 268 |
|
268 | 269 | if _, ok := node.Index(); ok { |
269 | | - return componentKey{}, fmt.Errorf("array indexes are not supported in prefix tree keys") |
| 270 | + return componentKey{}, errors.New("array indexes are not supported in prefix tree keys") |
270 | 271 | } |
271 | 272 |
|
272 | 273 | if _, _, ok := node.KeyValue(); ok { |
273 | | - return componentKey{}, fmt.Errorf("key-value selectors are not supported in prefix tree keys") |
| 274 | + return componentKey{}, errors.New("key-value selectors are not supported in prefix tree keys") |
274 | 275 | } |
275 | 276 |
|
276 | 277 | if key, ok := node.StringKey(); ok { |
|
0 commit comments