openconfig / ygot

A YANG-centric Go toolkit - Go/Protobuf Code Generation; Validation; Marshaling/Unmarshaling
Apache License 2.0
286 stars 107 forks source link

Don't accidentally create leaves using SetNode/GetOrCreateNode #544

Open wenovus opened 3 years ago

wenovus commented 3 years ago
2. going forward, we'll keep a note of the first entry that we initialise when doing `SetNode` or `GetOrCreate....`, and if the final call fails or is ignored (because it is a shadowpath), we'll uninitialise the first initialised node to undo our work. This will be for all use cases of this function.

_Originally posted by @robshakir in https://github.com/openconfig/ygot/pull/543#discussion_r651359155_

wenovus commented 1 year ago

A TODO comment: https://github.com/openconfig/ygot/blob/master/ytypes/node.go#L508-L511

There is also currently a unit test for it that has a TODO.