gopcua / opcua

Native Go OPC-UA library
MIT License
829 stars 253 forks source link

fix: ReferenceNodes usage with mask set #683

Closed sruehl closed 10 months ago

sruehl commented 10 months ago

resolves https://github.com/gopcua/opcua/issues/682 resolves https://github.com/gopcua/opcua/issues/550

sruehl commented 10 months ago

Another way would be to add a factory function to node.go accepting a ExpandedNode. Might be a bit more efficient.

kung-foo commented 10 months ago

I think your idea for a static factory function sounds cleanest. It would make it clear what is happening, and who should be using it.

sruehl commented 10 months ago

ok, I rebased the branch on main (not sure if that was necessary) and added a commit migrating this to the factory function (method). Instead adding it as a static I added it to client analogous to the c.Node call. This could also be moved to node.go and made be private if the exposed NodeFromExpandedNodeID doesn't make sense outside the ReferencedNodes call

kung-foo commented 10 months ago

Can you add a few tests to cover the conversion?

sruehl commented 10 months ago

sure will do

sruehl commented 10 months ago

731d545 contains the most relevant test where the arguments ensure the flag is set and the conversion ensure those are unset