nex-protocols-go
nex-protocols-go copied to clipboard
Migrate to new `nex-go` types
Resolves #XXX
Changes:
- Updates all code to use the new
nex-gotypes. See https://github.com/PretendoNetwork/nex-go/pull/56 for details - Removes the use of pointers where they shouldn't/can't be used
- Changes basic variable instancing to use
var name typerather than theNewTypefunctions. This is more commonly preferred in Go when aNewTypefunction doesn't do anything special/extra- Note: This only happens for basic types from the
nex-gochanges, any protocol types are still handled using theNewTypefunctions
- Note: This only happens for basic types from the
Marked as a draft for now since these changes are untested. Most done using regex-replace in VSC and some codegen. Some basic servers, not using nex-protocols-common-go, should be made to verify functionality.
I will not be making any changes to nex-protocols-common-go until these changes have been verified to be working.
Since structs are no longer bound to pointer fields now, a few extra changes can possibly be made:
-
NewTypefunctions can now likely just returnType{}rather than instantiating every field. This was done originally to ensure we didn't have anynilpointers, but with the removal of pointers this is no longer a concern -
The
Copymethods on structs can probably be updated to not callCopyinternally, rather they can likely just assign the field values directly due to the removal of pointers -
If the
NewTypefunctions are updated to just returnType{}then that means in each RMC handler we can also update any protocol types to usevar name type, just like the basic types, rather than usingNewType. This would keep things uniform and more Go-like -
[x] I have read and agreed to the Code of Conduct.
-
[x] I have read and complied with the contributing guidelines.
-
[ ] What I'm implementing was an approved issue.
-
[ ] I have tested all of my changes.