Help us shape the future of Go! Take the 2026 Go Developer Survey

ids

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ids is the single source of truth for node-ID normalization.

Adapted from Graphify's graphify/ids.py (Apache-2.0). The recipe must stay byte-for-byte identical to Graphify so graph.json files produced by either tool reference the same node IDs.

The recipe: iterate casefold then NFKC to a fixpoint, then replace runs of non-word characters with a single underscore, collapse repeated underscores and strip leading/trailing underscores.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsWord

func IsWord(r rune) bool

IsWord reports whether r matches Python's `\w` under re.UNICODE: alphanumeric characters (str.isalnum) and the underscore.

func MakeID

func MakeID(parts ...string) string

MakeID builds a canonical node ID from one or more name parts.

Empty parts are skipped, every part has stray '_' / '.' trimmed from its edges, the parts are joined with '_' and the result is normalized.

func NormalizeID

func NormalizeID(s string) string

NormalizeID converts s to its canonical ID form.

It is idempotent, caseless-stable and the result only contains word characters (as defined by Python's re \w with re.UNICODE) and '_'.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL