You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was refactoring some of the tests to take advantage of stretchr/testify/assert and ran into an interesting bug. It turns out the DHCPv4 options in dhcpv4/types.go are not all OptionCodes - only the first one is. The rest of them are ints due to the way the initialization works.
I forsee two fixes:
Prepend OptionCode before each =
Change the first line to OptionPad = iota and figure out what to do for the gaps in the range due to e.g. returned options.
The text was updated successfully, but these errors were encountered:
For how ugly it may look, I would rather prepend OptionCode before each line.
The reason is that iota should not be used for cases like this, when defining constants from some spec, they should only be used for internal use (like enums, but different). Unfortunately this is something I learned only after writing this code. This means that also MessageTypeDiscover and OpcodeBootRequest in the same file (and their blocks), should be converted to stop using iota and prepend the type before the assignment.
I was refactoring some of the tests to take advantage of
stretchr/testify/assert
and ran into an interesting bug. It turns out the DHCPv4 options in dhcpv4/types.go are not allOptionCode
s - only the first one is. The rest of them areint
s due to the way the initialization works.I forsee two fixes:
OptionCode
before each=
OptionPad = iota
and figure out what to do for the gaps in the range due to e.g. returned options.The text was updated successfully, but these errors were encountered: