Skip to content

Add ISO 3166-1:2020 + Unicode 13.0.0 support - #1

Open
TheTeaCat wants to merge 9 commits into
jayco:masterfrom
TheTeaCat:master
Open

Add ISO 3166-1:2020 + Unicode 13.0.0 support#1
TheTeaCat wants to merge 9 commits into
jayco:masterfrom
TheTeaCat:master

Conversation

@TheTeaCat

@TheTeaCat TheTeaCat commented Apr 7, 2021

Copy link
Copy Markdown

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 countryMap in emoji_flag.go: Kosovo (XKXXK), Curaçao (CUWCW), and Bonaire, Sint Eustatius and Saba (BESBQ). The author acknowledges the PR is incomplete. The GetFlag logic correctly handles all new entries — the regional indicator arithmetic works for all three alpha-2 codes.

  • emoji_flag.go: Three map entries appended; the existing GetFlag function 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

Filename Overview
emoji_flag.go Adds three new alpha-3→alpha-2 mappings (XKX→XK, CUW→CW, BES→BQ); logic is correct but no tests were added for the new entries, and XKX/XK are user-assigned codes rather than official ISO 3166-1:2020 codes as the PR claims.
README.md Removes three CI/CD badge links without explanation, updates the description to mention ISO 3166-1:2020 support, and adds example output and a note about the BES/BQ flag rendering caveat.
LICENSE Updates copyright year range to 2019–2021 and adds co-author Joshua O'Sullivan; no issues.

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
Loading
%%{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.-> N3
Loading

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
emoji_flag.go:255-257
**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.

### Issue 2 of 3
emoji_flag.go:255
**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.

### Issue 3 of 3
README.md:1-9
**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.

Reviews (1): Last reviewed commit: "Fix typo" | Re-trigger Greptile

Greptile also left 3 inline comments on this PR.

@TheTeaCat TheTeaCat changed the title Add Kosovo Add Kosovo and Curaçao Apr 9, 2021
@TheTeaCat TheTeaCat changed the title Add Kosovo and Curaçao Add ISO 3166-1:2020 + Unicode 13.0.0 support Apr 11, 2021
@jayco

jayco commented Jul 14, 2026

Copy link
Copy Markdown
Owner

@greptile

Comment thread emoji_flag.go
Comment on lines +255 to +257
"XKX": "XK",
"CUW": "CW",
"BES": "BQ",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

Fix in Claude Code

Comment thread emoji_flag.go
"YEM": "YE",
"ZMB": "ZM",
"ZWE": "ZW",
"XKX": "XK",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Fix in Claude Code

Comment thread README.md
Comment on lines 1 to 9
# go-emoji-flag

[![CircleCI](https://circleci.com/gh/jayco/go-emoji-flag.svg?style=svg)](https://circleci.com/gh/jayco/go-emoji-flag)
[![GolangCI](https://golangci.com/badges/github.com/jayco/go-emoji-flag.svg)](https://golangci.com)
[![Go Report Card](https://goreportcard.com/badge/github.com/jayco/go-emoji-flag)](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

```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

Fix in Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants