[go-fan] Go Module Review: rivo/uniseg

Abierto Apto para principiantes
#75,360 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
72/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go
Área
testing

Línea de trabajo

Empieza en pkg/cli/add_package_manifest_parse.go y lee isEmojiString e isEmojiGrapheme para ver cómo se validan las cadenas de iconos. Añade pruebas basadas en tablas que cubran los casos indicados de grafemas y cadenas, y luego ejecuta las pruebas de Go pertinentes. La tarea estará terminada cuando las pruebas ejerciten ambas funciones y confirmen el comportamiento de validación flexible previsto.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

automation cookie

🐹 Go Fan Report: rivo/uniseg

Module Overview

github.com/rivo/uniseg implements Unicode text segmentation (grapheme clusters, words, sentences, line breaks) and monospace string width.

Current Usage in gh-aw

  • Files: 1 file (pkg/cli/add_package_manifest_parse.go)
  • Import Count: 1
  • Version: v0.4.7 (latest tag)
  • Key APIs Used: uniseg.NewGraphemes, Graphemes.Next, Graphemes.Runes, all in isEmojiString, which validates the manifest icon field. Each grapheme cluster is checked by isEmojiGrapheme, which uses hand-written code-point ranges.
  • Terminal width is not measured with uniseg. lipgloss.Width and ansi.StringWidth are used instead.

Research Findings

Recent Updates
  • The last substantive default-branch commit is from 2024-04-13. v0.4.7 fixed variation-selector width. v0.4.5 added EastAsianAmbiguousWidth, and v0.4.6 included performance work. The repo pushed_at of 2026-11-05 shows no new release or default-branch commit in the tools used.
Best Practices
  • Use FirstGraphemeClusterInString or GraphemeClusterCount when the iterator state is not needed. They avoid allocation.

Improvement Opportunities

🏃 Quick Wins
  • Add a table test for isEmojiString and isEmojiGrapheme. No test calls them directly. Cover ZWJ families, skin-tone modifiers, flags, keycaps, ©, plain ASCII, mixed strings and :octicon-name:.
✨ Feature Opportunities
  • None needed today. StringWidth with EastAsianAmbiguousWidth is available but width is handled by the Charm stack.
📐 Best Practice Alignment
  • The base ranges 0x2300–0x23ff and 0x2600–0x27bf accept some non-emoji symbols. That is fine for a lenient icon check, but a comment would document the intent.
🔧 General Improvements
  • Replacing Graphemes.Runes() with FirstGraphemeClusterInString would reduce allocations. This is a micro-optimisation since the check runs once per manifest.
  • uniseg is a direct dependency used in a single function. github.com/clipperhouse/uax29/v2 is already an indirect dependency and could provide grapheme segmentation, which would let uniseg be dropped. This was not verified: shell access was denied mid-run, so go mod why -m github.com/rivo/uniseg and test-coverage checks were not run.

Recommendations

  1. Add unit tests for isEmojiString (high value, low effort).
  2. Run go mod why -m github.com/rivo/uniseg and decide whether to consolidate on uax29.
  3. Optionally switch to FirstGraphemeClusterInString.

Next Steps

  • Open a small PR for the tests. Evaluate the dependency consolidation separately.

Generated by Go Fan
Module summary saved to: scratchpad/mods/rivo-uniseg.md

Generated by 🐹 Go Fan · claude · routed: sonnet55 high · ~25 AIC · ⌖ ~1 AIC · ⊞ 5.7K · ◷

  • expires on Nov 7, 2026, 12:05 AM UTC-08:00
Lenguaje dominante
Go
Estrellas
5.6k
Forks
615
Merge medio
5 h 51 min
PR fusionados (30 d)
793

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de github/gh-aw

Todos los issues de github/gh-aw

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.