[PR #365] [CLOSED] fix: Use source generation for managing AAGUID dataset #849

Open
opened 2025-10-07 00:23:26 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/pocket-id/pocket-id/pull/365
Author: @ItalyPaleAle
Created: 3/20/2025
Status: Closed

Base: mainHead: aaguid-source-gen


📝 Commits (1)

  • a7407a9 Use source generation for managing AAGUID dataset

📊 Changes

6 files changed (+367 additions, -57 deletions)

View changed files

📝 .github/workflows/update-aaguids.yml (+20 -0)
backend/internal/utils/aaguid_map_gen.go (+265 -0)
📝 backend/internal/utils/aaguid_util.go (+8 -30)
📝 backend/internal/utils/aaguid_util_test.go (+3 -26)
📝 backend/resources/files.go (+2 -1)
backend/tools/gen-aaguid/main.go (+69 -0)

📄 Description

Small improvement over #332 as discussed here: https://github.com/pocket-id/pocket-id/pull/332#discussion_r2002362424

Instead of bundling the JSON file into the compiled binary, for it to be parsed at runtime, this uses source generation (go generate) to parse it at build-time and generate a Go file

Makes the code simpler (there's a Go map embedded in the source) as well as faster since there's no need to parse a JSON file at runtime (and synchronize concurrent access).

CC @kmendell


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/pocket-id/pocket-id/pull/365 **Author:** [@ItalyPaleAle](https://github.com/ItalyPaleAle) **Created:** 3/20/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `aaguid-source-gen` --- ### 📝 Commits (1) - [`a7407a9`](https://github.com/pocket-id/pocket-id/commit/a7407a9028b4cdbc00637a4443076bd0d18d2a35) Use source generation for managing AAGUID dataset ### 📊 Changes **6 files changed** (+367 additions, -57 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/update-aaguids.yml` (+20 -0) ➕ `backend/internal/utils/aaguid_map_gen.go` (+265 -0) 📝 `backend/internal/utils/aaguid_util.go` (+8 -30) 📝 `backend/internal/utils/aaguid_util_test.go` (+3 -26) 📝 `backend/resources/files.go` (+2 -1) ➕ `backend/tools/gen-aaguid/main.go` (+69 -0) </details> ### 📄 Description Small improvement over #332 as discussed here: https://github.com/pocket-id/pocket-id/pull/332#discussion_r2002362424 Instead of bundling the JSON file into the compiled binary, for it to be parsed at runtime, this uses source generation ([`go generate`](https://go.dev/blog/generate)) to parse it at build-time and generate a Go file Makes the code simpler (there's a Go map embedded in the source) as well as faster since there's no need to parse a JSON file at runtime (and synchronize concurrent access). CC @kmendell --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2025-10-07 00:23:26 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id#849