withCachedRegoValue returns a copy of the role with the cachedRegoValue. It does not mutate the underlying role. Avoid using this function if possible, it should only be used if the caller can guarantee the role is static and will never change.
()
| 148 | // Avoid using this function if possible, it should only be used if the |
| 149 | // caller can guarantee the role is static and will never change. |
| 150 | func (role Role) withCachedRegoValue() Role { |
| 151 | tmp := role |
| 152 | tmp.cachedRegoValue = role.regoValue() |
| 153 | return tmp |
| 154 | } |
| 155 | |
| 156 | func (role Role) regoValue() ast.Value { |
| 157 | if role.cachedRegoValue != nil { |
no test coverage detected