🐍 Mood: Having extremely unstable wifi and using a ridiculously long ethernet cable across my entire house aka a giant trip cord.

🎵 Soundtrack: Songs from the Arc of Life

🔌 Wifi Woes

Initially my wifi would work for 5 minutes before needing to be restarted. Only my work computer was having issues. Then it needed to be restarted every 3 minutes. Then 30 seconds. Restarting my computer multiple times did not fix it. Restarting the router did not fix it. Nothing fixed it. Eventually I got the reeeeeeeeeeeally long ethernet cable out.

🩺 Gopls Tests

It turns out my mega code actions feature breaks some existing tests. I starred at them for awhile and I was going to dig deeper into it, but then I got distracted by a github issue.

🇫🇷🇬🇧 Language Matching

Someone opened an issue where go is matching the wrong language. This piqued my interest because back on day 10 I had done a little digging into language matching.

I had fun digging into this bug and this is what I found out so far. I also added the following to the issue as a comment.

Some background Context

  1. Match calls getBest .
  2. getBest loops through all of the provided tags. It keeps track of a best option. It calls best.update for each provided tag. If the tag is a better match than the current best, then it updates best.

For the working as expected case with desired, _, err := language.ParseAcceptLanguage("en-GB;q=1.0, fr-DE;q=0.9, fr-CA;q=0.8")

  1. Because English is only in the list of tags once, pin for en-GB is true.
  2. This sets m.LanguagePin to true here.
  3. en-GB is initially made the best option because it is first and beaten is set to true here.
  4. Then the loop continues and best.update is called for the next tags one at a time.
  5. Because m.LanguagePin is true, every tag after en-GB returns from update here and does not replace en-GB as best.
  6. Thus en-GB is returned as the best match.

For the buggy case with desired, _, err := language.ParseAcceptLanguage("en-GB;q=1.0, fr;q=0.9, fr-CA;q=0.8, en-DE;q=0.7")

  1. Because English is only in the list of tags twice, pin for en-GB is false.
  2. This sets m.LanguagePin to false here.
  3. en-GB is initially made the best option because it is first and beaten is set to true here.
  4. Then the loop continues and best.update is called for the next tag fr-DE.
  5. Since m.LanguagePin is false, it does NOT return from update here like in the example above.
  6. This tag makes it into a tie breaker with en-GB. fr-DE ends up winning the tie-breaker here.
  7. Thus fr-DE is returned as the best match.

❓ My main open question is: Where do the weights come into play? And why didn’t the weights prevent French from beating English?

🎉😱 I’m listed as a contributor!

After submitting my comment mentioned above I saw a tag I never saw before. I am listed as a contributor! :D :D :D :D :D