exec: fix case-insensitive file name collision - #4129
Conversation
| } | ||
|
|
||
| func addBuild(filename string, p *ast.Position, data *Data, builds *map[string]*Data) { | ||
| func addBuild(fnCase string, fnKey string, p *ast.Position, data *Data, builds *map[string]*build) { |
There was a problem hiding this comment.
| func addBuild(fnCase string, fnKey string, p *ast.Position, data *Data, builds *map[string]*build) { | |
| func addBuild(fnCase, fnKey string, p *ast.Position, data *Data, builds *map[string]*build) { |
There was a problem hiding this comment.
The abbreviation you chose fn for fnCase and fnKey is commonly used to mean function so it may be a little confusing here?
There was a problem hiding this comment.
Also, even in gigantic projects, the number of files is probably not significant, as you do in a number of the other functions, so I'm not sure that we need to bother passing the same data fnCase and fnKey here, when we can just re-compute fnKey from strings.ToLower(filename)
|
Hi! I appreciate your PR, but the fmt-and-lint check failed with: And when I looked at the lint failures, I questioned whether we need to change that signature at all, since the strings.ToLower() conversion of a filename is not going to make a measurable performance impact at the scale of the number of files in the vast majority of projects. BTW, https://github.com/SimonWaldherr/golang-benchmarks#caseinsensitivecompare shows that strings.ToUpper() is faster and has fewer allocations. |
Similar to #2829.
codegen/testserver/casesensitivity/to demonstrate the problem