Skip to content

Commit 13a6771

Browse files
authored
Replace IsConfig()'s implementation with goyang's ReadOnly(). (#604)
ReadOnly()'s implementation is a bit more robust, and has the same functionality.
1 parent 29aeec1 commit 13a6771

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

util/yang.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,7 @@ func fixYangRegexp(pattern string) string {
303303
// the state. If the element at the top of the tree does not have config set, then config
304304
// is true. See https://tools.ietf.org/html/rfc6020#section-7.19.1.
305305
func IsConfig(e *yang.Entry) bool {
306-
for ; e.Parent != nil; e = e.Parent {
307-
switch e.Config {
308-
case yang.TSTrue:
309-
return true
310-
case yang.TSFalse:
311-
return false
312-
}
313-
}
314-
315-
// Reached the last element in the tree without explicit configuration
316-
// being set.
317-
return e.Config != yang.TSFalse
306+
return !e.ReadOnly()
318307
}
319308

320309
// isPathChild takes an input slice of strings representing a path and determines

0 commit comments

Comments
 (0)