Phase 0.2: Remove GTK/glib dependencies and replace C idioms #3

Open
opened 2026-06-07 22:43:31 -06:00 by ppreeper · 0 comments
Owner

Description

The existing Go code is a direct translation from C and retains many GLib/GTK idioms that don't belong in a Go web app. Every module needs to be cleansed.

Replacements

C idiom Go replacement
GArray []T (Go slices)
gint / gfloat / gboolean int / float64 / bool
gpointer any / interface{}
gchar * string
g_array_index() slice indexing
g_ptr_array_* []*T
g_string_* strings.Builder
g_sprintf / sprintf fmt.Sprintf
g_free / g_strdup none needed (GC)
GTK_WIDGET\* / GtkWidget remove entirely

Approach

Refactor in-place as we touch each module for the web conversion. Don't attempt to do all files at once — start with the files needed for Phase 1 core engine.

Acceptance Criteria

  • No #include, GArray, gint, gpointer, or GTK references remain in Go source files
  • All data structures use native Go types
  • Functions use Go-style signatures
## Description The existing Go code is a direct translation from C and retains many GLib/GTK idioms that don't belong in a Go web app. Every module needs to be cleansed. ## Replacements | C idiom | Go replacement | |---------|---------------| | `GArray` | `[]T` (Go slices) | | `gint` / `gfloat` / `gboolean` | `int` / `float64` / `bool` | | `gpointer` | `any` / `interface{}` | | `gchar *` | `string` | | `g_array_index()` | slice indexing | | `g_ptr_array_*` | `[]*T` | | `g_string_*` | `strings.Builder` | | `g_sprintf` / `sprintf` | `fmt.Sprintf` | | `g_free` / `g_strdup` | none needed (GC) | | `GTK_WIDGET\* / GtkWidget` | remove entirely | ## Approach Refactor in-place as we touch each module for the web conversion. Don't attempt to do all files at once — start with the files needed for Phase 1 core engine. ## Acceptance Criteria - No `#include`, `GArray`, `gint`, `gpointer`, or GTK references remain in Go source files - All data structures use native Go types - Functions use Go-style signatures
ppreeper added this to the Phase 0 milestone 2026-06-07 22:50:12 -06:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ppreeper/bygfoot#3
No description provided.