-
Notifications
You must be signed in to change notification settings - Fork 1k
Make case sensitivity optional #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make case sensitivity optional #282
Conversation
Codecov Report
@@ Coverage Diff @@
## master #282 +/- ##
==========================================
+ Coverage 81.27% 81.32% +0.05%
==========================================
Files 41 41
Lines 4971 4979 +8
==========================================
+ Hits 4040 4049 +9
+ Misses 814 810 -4
- Partials 117 120 +3
Continue to review full report at Codecov.
|
I tried unit tests on the master branch and many tests were broken. I suspect it's caused by dependency issues? I used "dep ensure" to download dependencies. It's much appreciated If you have some pointers on how to solve the local unit test failures. go test ./... output: https://raw.githubusercontent.com/caesarxuchao/go/test/testlog |
@caesarxuchao I faced the similar issue in running tests. I used the following command to fetch test dependencies, and it worked |
Thanks @sai-g. I also installed the json-iter/go at the wrong path. After moving it to $GOPATH/github.com/json-iterator/go, and run |
@@ -51,7 +52,7 @@ func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structF | |||
return &skipObjectDecoder{typ} | |||
case 1: | |||
for fieldName, fieldDecoder := range fields { | |||
fieldHash := calcHash(fieldName) | |||
fieldHash := calcHash(fieldName, ctx.caseSensitive()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this code above also make decoding case-insensitive?
for k, binding := range bindings {
if _, found := fields[strings.ToLower(k)]; !found {
fields[strings.ToLower(k)] = binding.Decoder.(*structFieldDecoder)
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test case that exercises positive and negative cases would be good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #285
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this code above also make decoding case-insensitive?
Yes, this was the culprit.
…sensitivity Make case sensitivity optional
Fix kubernetes/kubernetes#64612