Repository navigation
Changes to support ICS network on windows - #1755
Conversation
| case MacPool: | ||
| config.MacPools = make([]hcsshim.MacPool, 0) | ||
| s := strings.Split(value, ",") | ||
| for i := 0; i < len(s)-1; i += 2 { |
There was a problem hiding this comment.
Won't the last two elements be discarded because of the -1 in i < len(s)-1 ?
There was a problem hiding this comment.
The mac pool range must be specified in pair. For odd number length I want to ignore the last value. If you want we can throw an error in case of odd numbers.
There was a problem hiding this comment.
Oh, ok, I was assuming this will always come with an even number of elements.
As you suggested, I think it is better to explicitly fail in case of a malformed request, odd number of elements.
|
LGTM |
Signed-off-by: Sandeep Bansal <sabansal@microsoft.com>
| if len(s)%2 != 0 { | ||
| return nil, types.BadRequestErrorf("Invalid mac pool. You must specify both a start range and an end range") | ||
| } | ||
| for i := 0; i < len(s)-1; i += 2 { |
There was a problem hiding this comment.
with the <, you don't really need the -1 in the upper bound of the loop (also because you already checked that the number of elements is even).
if len(s) == 2 in the first loop i = 0, then i = 2 < 2 is already false
There was a problem hiding this comment.
Accepted but not taking this change. Will address in some future iteration. Thanks.
|
@sanimej PTAL |
|
LGTM (not a maintainer on this repo). |
|
LGTM |
We were missing some basic properties. Added that.
Signed-off-by: Sandeep Bansal sabansal@microsoft.com