chore: Maintain consistency between languages functions#63292
Conversation
mmanela
left a comment
There was a problem hiding this comment.
Thanks @varungandhi-src . Couple questions/comments added
There was a problem hiding this comment.
This is such a great idea! Will remember this for the future
There was a problem hiding this comment.
You already clone above, do you need to clone again?
There was a problem hiding this comment.
I also find it surprising that go-enry would return shared state. I am still new to Go and their library ecosystem but I would hope people would return immutable data (or at least data that was a copy )
There was a problem hiding this comment.
Removed this extra clone
There was a problem hiding this comment.
Go natively does not have any concept of immutable data except for a wink and a hand-shake, and IME the ecosystem largely copies the standard library in terms of not trying too hard to avoid footguns.
e786b39 to
a8422af
Compare
The different functions in the languages package ought to be mutually
consistent in how they handle language<->extension mappings.
Since we have complex logic in some functions, we need to make
sure that newly added APIs take all the edge cases into account,
and add tests so that we can catch regressions with enry upgrades.
This PR also adds the
enrypackage to depguard, so that peopledo not accidentally use enry APIs instead of the corresponding APIs
in the
languagespackage.Test plan
Added tests.
Changelog