Add ISO 3166-1:2020 + Unicode 13.0.0 support - #1
Conversation
| "XKX": "XK", | ||
| "CUW": "CW", | ||
| "BES": "BQ", |
There was a problem hiding this comment.
No tests for newly added country codes
The test file only covers AUS/AU as representative inputs. None of the three new entries (XKX/XK, CUW/CW, BES/BQ) have test cases, so a typo in any mapping would go undetected. For instance, the BES → BQ mapping could silently produce an incorrect flag if the value were accidentally transposed — the existing test suite wouldn't catch it.
Prompt To Fix With AI
This is a comment left during a code review.
Path: emoji_flag.go
Line: 255-257
Comment:
**No tests for newly added country codes**
The test file only covers `AUS`/`AU` as representative inputs. None of the three new entries (`XKX`/`XK`, `CUW`/`CW`, `BES`/`BQ`) have test cases, so a typo in any mapping would go undetected. For instance, the `BES → BQ` mapping could silently produce an incorrect flag if the value were accidentally transposed — the existing test suite wouldn't catch it.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| "YEM": "YE", | ||
| "ZMB": "ZM", | ||
| "ZWE": "ZW", | ||
| "XKX": "XK", |
There was a problem hiding this comment.
XKX/XK are user-assigned codes, not ISO 3166-1 entries
XKX (Kosovo alpha-3) and XK (Kosovo alpha-2) are user-assigned reservation codes adopted by the EU and other organizations but are explicitly not part of ISO 3166-1:2020. The PR description and README both advertise this change as "ISO 3166-1:2020 alpha-2/alpha-3 support", which is inaccurate for this entry. Including Kosovo is pragmatically reasonable, but the documentation should clarify it as a user-assigned extension rather than an ISO code.
Prompt To Fix With AI
This is a comment left during a code review.
Path: emoji_flag.go
Line: 255
Comment:
**XKX/XK are user-assigned codes, not ISO 3166-1 entries**
`XKX` (Kosovo alpha-3) and `XK` (Kosovo alpha-2) are user-assigned reservation codes adopted by the EU and other organizations but are explicitly **not** part of ISO 3166-1:2020. The PR description and README both advertise this change as "ISO 3166-1:2020 alpha-2/alpha-3 support", which is inaccurate for this entry. Including Kosovo is pragmatically reasonable, but the documentation should clarify it as a user-assigned extension rather than an ISO code.
How can I resolve this? If you propose a fix, please make it concise.| # go-emoji-flag | ||
|
|
||
| [](https://circleci.com/gh/jayco/go-emoji-flag) | ||
| [](https://golangci.com) | ||
| [](https://golangci.com) | ||
|
|
||
| Converts a string country code to an emoji in Go. | ||
|
|
||
| Supports the country codes of [ISO 3166-1:2020 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) and [ISO 3166-1:2020 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) where Unicode 13.0.0 has appropriate emoji flags available. | ||
|
|
||
| ## Install | ||
|
|
||
| ``` |
There was a problem hiding this comment.
CI badge removal is unexplained
The CircleCI, GolangCI, and Go Report Card badges were removed without any explanation in the PR description. If the pipelines are broken or the services are no longer in use, that context would help reviewers understand the intent. If they are still active, removing them reduces visibility into build and lint health for contributors.
Prompt To Fix With AI
This is a comment left during a code review.
Path: README.md
Line: 1-9
Comment:
**CI badge removal is unexplained**
The CircleCI, GolangCI, and Go Report Card badges were removed without any explanation in the PR description. If the pipelines are broken or the services are no longer in use, that context would help reviewers understand the intent. If they are still active, removing them reduces visibility into build and lint health for contributors.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Add support for the country codes of ISO 3166-1:2020 alpha-2 and ISO 3166-1:2020 alpha-3 where Unicode 13.0.0 has appropriate emoji flags available.
Incomplete but making this PR early.
Greptile Summary
This PR adds three new country-code mappings to the
countryMapinemoji_flag.go: Kosovo (XKX→XK), Curaçao (CUW→CW), and Bonaire, Sint Eustatius and Saba (BES→BQ). The author acknowledges the PR is incomplete. TheGetFlaglogic correctly handles all new entries — the regional indicator arithmetic works for all three alpha-2 codes.emoji_flag.go: Three map entries appended; the existingGetFlagfunction handles them correctly for both 3-char and 2-char lookup paths.README.md: CI badges removed without explanation, description updated to mention ISO 3166-1:2020, and example output extended with the new codes.LICENSE: Copyright year and co-author updated.Confidence Score: 4/5
The mapping additions are correct and the existing GetFlag logic handles all new entries without modification; the change is safe to merge.
The three new map entries are data-only changes that work correctly with the existing function. The main gaps are missing test coverage for the new entries and a mismatch between the PR's ISO 3166-1:2020 framing and the XKX/XK codes, which are user-assigned rather than official ISO codes. Neither issue causes incorrect runtime behavior.
emoji_flag.go — no tests cover the three new mappings; a typo in any value would go undetected by the current test suite.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[GetFlag input] --> B{len == 3?} B -- Yes --> C{countryMap lookup} C -- Found --> D[Build emoji from alpha-2 value] C -- Not found --> E{len == 2?} B -- No --> E E -- Yes --> F[Linear scan of countryMap values] F --> G{Match found?} G -- Yes --> H[Build emoji from input directly] G -- No --> I[Return empty string] D --> J[Return emoji string] H --> J subgraph New entries N1["XKX → XK (Kosovo)"] N2["CUW → CW (Curaçao)"] N3["BES → BQ (Bonaire etc.)"] end C -.uses.-> N1 C -.uses.-> N2 C -.uses.-> N3%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% flowchart TD A[GetFlag input] --> B{len == 3?} B -- Yes --> C{countryMap lookup} C -- Found --> D[Build emoji from alpha-2 value] C -- Not found --> E{len == 2?} B -- No --> E E -- Yes --> F[Linear scan of countryMap values] F --> G{Match found?} G -- Yes --> H[Build emoji from input directly] G -- No --> I[Return empty string] D --> J[Return emoji string] H --> J subgraph New entries N1["XKX → XK (Kosovo)"] N2["CUW → CW (Curaçao)"] N3["BES → BQ (Bonaire etc.)"] end C -.uses.-> N1 C -.uses.-> N2 C -.uses.-> N3Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "Fix typo" | Re-trigger Greptile