Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
6a8c408
build(go): Unicode tables generated from the reference engine: L, Lu,…
4matic Nov 13, 2026
a839646
build(go): module skeleton, data codegen, types, options, JSON writer…
4matic Nov 13, 2026
febb73c
build(go): single-track pipeline: R1 normalize, R2 mode, R3 scanner, …
4matic Nov 13, 2026
c4df58b
build(go): skeleton helpers take *skel, junk kinds and version types …
4matic Nov 13, 2026
1526b46
build(go): artist side of the pipeline: R5 classify, R7 artists and c…
4matic Nov 13, 2026
c3ea41e
test(go): artist-side tests against JS values: parseArtists, R5 versi…
4matic Nov 13, 2026
3ef0637
build(go): tracklists (R13): line split, time scanner and formatting,…
4matic Nov 13, 2026
1ff3cc7
build(go): unit tests for the tracklist modules that do not need the …
4matic Nov 13, 2026
b3b660e
ci: the Go fixture test and the Go compare job fail hard
4matic Nov 13, 2026
def6bcf
build(go): tracklists finish each line from its probe instead of pars…
4matic Nov 13, 2026
979b058
build(go): runnable examples for pkg.go.dev, checked by go test
4matic Nov 13, 2026
c4a9d1e
ci: release-please go component, tagged go/vX.Y.Z, in the linked vers…
4matic Nov 13, 2026
9117798
ci: publish-go job: test the tag, fetch it through the module proxy, …
4matic Nov 13, 2026
5dd9a71
ci: spec.yml checks that SpecVersion in go/data_gen.go is linked with…
4matic Nov 13, 2026
f178905
build(go): write the zero-width space in ExampleNormalize as an escape
4matic Nov 13, 2026
b4a566f
build(go): the suggestion search copies time fields on the stack inst…
4matic Nov 13, 2026
13184fd
test(go): seeded property tests for the SPEC invariants and R13.11, s…
4matic Nov 13, 2026
ce9bf91
docs(go): README for the Go module, shown on pkg.go.dev
4matic Nov 13, 2026
edb4a1d
chore: AGENTS.md covers the Go port: repo map, commands, docs convent…
4matic Nov 13, 2026
c1f8d01
chore: AGENTS.md names the Go fuzz targets and fuzz_test.go
4matic Nov 13, 2026
b7d56e8
docs: the Go module in the root README: badges, install, quick start,…
4matic Nov 13, 2026
7faf03e
docs(js): list the Go module among the other languages
4matic Nov 13, 2026
4f3a6ff
docs(python): list the Go module among the other languages
4matic Nov 13, 2026
cfc09b0
docs(rust): list the Go module among the other languages, and its Uni…
4matic Nov 13, 2026
ad8c344
docs(fixtures): the Go runner, matcher, skip list and commands
4matic Nov 13, 2026
9380450
docs(generator): run the Go port on regenerated fixtures
4matic Nov 13, 2026
128fc50
docs: link the renamed porting guide heading in AGENTS.md
4matic Nov 13, 2026
1fde87d
build(go): ignore Go test binaries
4matic Nov 13, 2026
e185e54
test(go): fuzz targets for Parse, ParseArtists, Format, ParseTracklis…
4matic Nov 13, 2026
766e0ee
feat(site): Go in the language switch, the install line and the playg…
4matic Nov 13, 2026
712f39d
docs(site): a Go tab in every example, and Go names in the guides and…
4matic Nov 13, 2026
ee2ef51
docs(site): the Go port on the ports, testing, contributing and proje…
4matic Nov 13, 2026
db3baf4
test: the port runners and the output diff of compare-ports move to s…
4matic Nov 13, 2026
958a20f
test: scripts/fuzz-ports.mjs, a random differential run of single tra…
4matic Nov 13, 2026
42ea65d
ci(go): weekly fuzz job, and the module built and tested from git arc…
4matic Nov 13, 2026
b5cc839
build(go): strings in typed edits with invalid UTF-8 are replaced by …
4matic Nov 13, 2026
9f3308a
test(go): the insert and delete property skips texts with a bare CR, …
4matic Nov 13, 2026
6c0f6cf
test(go): time ceilings for 10,000 code points, repeated feat. credit…
4matic Nov 13, 2026
7bb0d23
docs: AGENTS.md lists fuzz-ports and the shared port runners, Go timi…
4matic Nov 14, 2026
28603d1
feat(go): the Go module: parse, tracklists and edits with options tha…
4matic Nov 14, 2026
44c9e8a
build(go): the All lists are functions that return a fresh slice, and…
4matic Nov 14, 2026
b4bd071
build(go): the compare-ports dump command moves to internal/cmd/dump
4matic Nov 14, 2026
6caa8be
build(go): the JSON door is linked only with -tags trackparse_wire, s…
4matic Nov 14, 2026
74bf5f6
test(go): the module zip drops 3.3 MB of test data: a 280 KB Unicode …
4matic Nov 14, 2026
628b796
test(go): 16 goroutines against a sequential run, and a fuzz target f…
4matic Nov 14, 2026
4e3e030
docs(go): ApplyEdits keeps unwritten lines byte-identical after inval…
4matic Nov 14, 2026
87baa0a
fix(site): the playground's Go tracklist code prints with a json.Enco…
4matic Nov 14, 2026
e88e00d
test(go): benchmarks for 10,000 code points of each repeated block, a…
4matic Nov 14, 2026
38e386f
docs: the Go module is described as published, with exact Unicode ver…
4matic Nov 14, 2026
f9e405d
ci: allow the go scope in PR titles
4matic Nov 14, 2026
55ff919
docs(js): the README shows SPEC_VERSION without a hard-coded version,…
4matic Nov 14, 2026
5913dac
docs(python): the README's format_track examples parse their own trac…
4matic Nov 14, 2026
2adb520
docs(rust): the README shows feat_marker, links the spec changelog, a…
4matic Nov 14, 2026
1dcbeb1
docs(go): a package overview with an example and links, fuller Normal…
4matic Nov 14, 2026
968b6ff
docs(fixtures): the Rust command for running one fixture case
4matic Nov 14, 2026
9a20f92
docs: AGENTS.md lists the Go test helpers, the go.yml module-zip and …
4matic Nov 14, 2026
f43df0d
fix(site): playground code is rustfmt-clean and escapes invisible cha…
4matic Nov 14, 2026
ad88bbe
docs(site): real outputs instead of summaries in every language, and …
4matic Nov 14, 2026
7f10e41
docs(rust): the crate description names the Go module
4matic Nov 14, 2026
d45fc66
docs: the root README notes json.Marshal escaping in Go, the Go diffe…
4matic Nov 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 165 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
name: go

on:
push:
branches: [main]
# The fuzz job: weekly, or by hand.
schedule:
- cron: "17 3 * * 1"
workflow_dispatch:
pull_request:
paths:
- "go/**"
- "spec/**"
# The tests read the R0 primitives dumped from JS there.
- "rust/tests/data/**"
# The compare job diffs the module against the built JS package.
- "js/src/**"
- "scripts/compare-ports.mjs"
- "scripts/lib/ports.mjs"
- ".github/workflows/go.yml"

permissions:
contents: read

env:
# Test with the toolchain of the matrix, never an automatic download.
GOTOOLCHAIN: local

jobs:
test:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# stable, and the floor from go/go.mod (the `go` line).
go: [stable, "1.22.x"]
defaults:
run:
working-directory: go
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: ${{ matrix.go }}
cache: false
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: pnpm
# The artist-side tests read testdata/artist_cases.json, which is too big to commit (it
# would ship in the module zip): write it from the built JS package.
- name: Artist cases from the JS package
run: |
pnpm install --frozen-lockfile
pnpm --filter trackparse build
node go/scripts/dump_artist_cases.mjs
working-directory: .
- name: Data codegen is up to date
run: node scripts/gen_data.mjs --check
- name: Unicode codegen is up to date
run: node scripts/gen_unicode.mjs --check
- if: matrix.go == 'stable'
name: gofmt
run: test -z "$(gofmt -l .)" || { gofmt -l .; exit 1; }
- run: go vet ./...
# wire_hook.go and internal/cmd/dump with the JSON door linked in.
- run: go vet -tags trackparse_wire ./...
- if: matrix.go == 'stable'
name: staticcheck
env:
GOTOOLCHAIN: auto
run: |
go run honnef.co/go/tools/cmd/staticcheck@2026.2.2 ./...
go run honnef.co/go/tools/cmd/staticcheck@2026.2.2 -tags trackparse_wire ./...
- name: No unstable sorts
# JS sorts are stable; sort.Slice is not. Use slices.SortStableFunc.
run: "! grep -n 'sort\\.Slice(' --include='*.go' -r ."
- name: go.mod has no dependencies
run: "! grep -q '^require' go.mod"
# Every shared fixture, the primitives and the API tests.
- run: go test -race ./...
env:
TRACKPARSE_REQUIRE_ARTIST_CASES: "1"
# The committed Unicode sample is small; this compares every code point and more with Node.
- if: matrix.go == 'stable'
name: Full Unicode check against Node
run: go test -run '^TestUnicodeFull$' -count=1 .
env:
TRACKPARSE_UNICODE_FULL: "1"

# Every fixture input through the built JS package and the Go module: full outputs must match.
compare:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: stable
cache: false
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm --filter trackparse build
- run: node scripts/compare-ports.mjs --only=go

# The module as the Go proxy will serve it: only what `git archive` puts under go/, without
# ../spec or ../rust. The fixture and primitive tests must skip; everything else must pass.
module-zip:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: stable
cache: false
- name: Build and test go/ alone
run: |
dir="$(mktemp -d)"
git archive HEAD go/ | tar -x -C "$dir"
cd "$dir/go"
test -z "$(find .. -maxdepth 1 -mindepth 1 ! -name go)"
if grep -q '^require' go.mod; then echo "go.mod has dependencies"; exit 1; fi
go vet ./...
go test -count=1 ./...

# Each fuzz target for a fixed time, seeded with every fixture input. Weekly and by hand.
fuzz:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# FuzzParse checks every mode per input and spends its first minute or so on the seeds.
include:
- { target: FuzzParse, time: 5m }
- { target: FuzzParseArtists, time: 3m }
- { target: FuzzFormat, time: 3m }
- { target: FuzzParseTracklist, time: 3m }
- { target: FuzzApplyEdits, time: 3m }
- { target: FuzzRun, time: 3m }
- { target: FuzzUnmarshalTrack, time: 3m }
defaults:
run:
working-directory: go
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: stable
cache: false
- run: go test -run '^$' -fuzz '^${{ matrix.target }}$' -fuzztime ${{ matrix.time }} .
- if: failure()
name: Keep the failing input
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: fuzz-${{ matrix.target }}
path: go/testdata/fuzz
if-no-files-found: ignore
1 change: 1 addition & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
fixtures
python
rust
go
site
ci
deps
Expand Down
161 changes: 159 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: release

# release-please keeps a "chore: release" PR up to date from conventional commits on main.
# Merging that PR tags js-vX.Y.Z / spec-vX.Y.Z / python-vX.Y.Z / rust-vX.Y.Z, creates the GitHub
# Releases, and publishes to npm, PyPI and (once enabled) crates.io.
# Merging that PR tags js-vX.Y.Z / spec-vX.Y.Z / python-vX.Y.Z / rust-vX.Y.Z / go/vX.Y.Z, creates
# the GitHub Releases, and publishes to npm, PyPI and (once enabled) crates.io. The Go module has
# no registry upload: the go/vX.Y.Z tag is the release, and publish-go only checks it through the
# Go module proxy.

on:
push:
Expand All @@ -17,6 +19,10 @@ on:
description: "Re-publish an existing rust release tag to crates.io (e.g. rust-v0.5.0). Leave empty for a normal release-please run."
required: false
default: ""
go_tag:
description: "Re-run the Go module checks for an existing go release tag (e.g. go/v0.6.0). Leave empty for a normal release-please run."
required: false
default: ""

permissions: {}

Expand All @@ -40,6 +46,10 @@ jobs:
rust_release_created: ${{ steps.release.outputs['rust--release_created'] }}
rust_tag_name: ${{ steps.release.outputs['rust--tag_name'] }}
rust_version: ${{ steps.release.outputs['rust--version'] }}
# The path is "go", so the keys are go--*; the tag itself is go/vX.Y.Z (tag-separator "/").
go_release_created: ${{ steps.release.outputs['go--release_created'] }}
go_tag_name: ${{ steps.release.outputs['go--tag_name'] }}
go_version: ${{ steps.release.outputs['go--version'] }}
steps:
- uses: googleapis/release-please-action@v4
id: release
Expand Down Expand Up @@ -325,3 +335,150 @@ jobs:
echo "crates.io: https://crates.io/crates/trackparse/${VERSION} · docs: https://docs.rs/trackparse/${VERSION}"
} > notes.md
gh release edit "$TAG" --notes-file notes.md

# The Go module is published by its tag: there is no upload and no token. The proxy
# (proxy.golang.org) and the checksum database (sum.golang.org) fetch go/vX.Y.Z on the first
# request and keep that content forever; a bad version can only be retracted in go/go.mod and
# replaced by a new one. This job tests the tagged tree, makes that first request, installs the
# module from a clean module through the proxy, and adds install notes to the GitHub Release.
publish-go:
needs: release-please
if: needs.release-please.outputs.go_release_created == 'true' || (github.event_name == 'workflow_dispatch' && inputs.go_tag != '')
runs-on: ubuntu-latest
environment:
name: go
url: https://pkg.go.dev/github.com/4matic/trackparse/go
permissions:
contents: write # edit the GitHub Release notes
env:
# Test with the toolchain set up below, never an automatic download.
GOTOOLCHAIN: local
MODULE: github.com/4matic/trackparse/go
steps:
- name: Resolve the release tag
id: tag
env:
RELEASED_TAG: ${{ needs.release-please.outputs.go_tag_name }}
RELEASED_VERSION: ${{ needs.release-please.outputs.go_version }}
INPUT_TAG: ${{ inputs.go_tag }}
run: |
if [ -n "$INPUT_TAG" ]; then
tag="$INPUT_TAG"
else
tag="$RELEASED_TAG"
fi
# The go command only finds a module in go/ under tags named go/vX.Y.Z.
if ! printf '%s' "$tag" | grep -Eq '^go/v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "the go tag must look like go/vX.Y.Z, got '$tag'" >&2
exit 1
fi
version="${tag#go/v}"
if [ -z "$INPUT_TAG" ] && [ "$version" != "$RELEASED_VERSION" ]; then
echo "tag $tag does not match the released version $RELEASED_VERSION" >&2
exit 1
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
ref: ${{ steps.tag.outputs.tag }}
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: stable
# No cache in the publishing job: nothing restored from a cache ends up in the release.
cache: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24

- name: Verify versions are in sync
env:
TAG_VERSION: ${{ steps.tag.outputs.version }}
run: |
go_version=$(sed -n 's/^const SpecVersion = "\([^"]*\)".*/\1/p' go/data_gen.go)
spec_version=$(cat spec/VERSION)
echo "go=$go_version spec=$spec_version tag=$TAG_VERSION"
test "$go_version" = "$TAG_VERSION"
test "$spec_version" = "$TAG_VERSION"
node go/scripts/gen_data.mjs --check

- name: Test
working-directory: go
run: |
go vet ./...
go test ./...

# The first request makes the proxy fetch the tag and the checksum database record it.
# A fresh tag can take a moment to become visible, so retry.
- name: Fetch the version through the module proxy
env:
VERSION: ${{ steps.tag.outputs.version }}
run: |
cd "$RUNNER_TEMP"
for attempt in 1 2 3 4 5 6 7 8 9 10; do
if GOPROXY=https://proxy.golang.org go list -m "$MODULE@v$VERSION"; then
exit 0
fi
echo "attempt $attempt: the proxy does not serve v$VERSION yet" >&2
sleep $((attempt * 15))
done
exit 1

# Install from a clean module, with the default GOPROXY and GOSUMDB, as a user would.
- name: go get from a clean module
env:
VERSION: ${{ steps.tag.outputs.version }}
run: |
dir="$RUNNER_TEMP/go-get-check"
mkdir -p "$dir"
cd "$dir"
go mod init example.com/check
go get "$MODULE@v$VERSION"
cat > main.go <<'EOF'
package main

import (
"fmt"

trackparse "github.com/4matic/trackparse/go"
)

func main() {
t := trackparse.Parse("Noisia - Stigma (2015)")
fmt.Println(trackparse.SpecVersion, t.Artists[0].Name, t.Title, *t.Year)
}
EOF
got=$(go run .)
want="$VERSION Noisia Stigma 2015"
echo "got: $got"
echo "want: $want"
test "$got" = "$want"

# pkg.go.dev adds a version on any proxy request for it (https://pkg.go.dev/about); the
# steps above made one. The page can take a few minutes to appear.
- name: Request the version on pkg.go.dev
env:
VERSION: ${{ steps.tag.outputs.version }}
run: curl -fsS -o /dev/null "https://proxy.golang.org/$MODULE/@v/v$VERSION.info"

- name: Add install notes to the GitHub Release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ steps.tag.outputs.tag }}
VERSION: ${{ steps.tag.outputs.version }}
run: |
highlights=".github/release-notes/${VERSION}.md"
{
if [ -f "$highlights" ]; then cat "$highlights"; echo; fi
gh release view "$TAG" --json body --jq .body
echo
echo "### Install"
echo
echo '```sh'
echo "go get ${MODULE}@v${VERSION}"
echo '```'
echo
echo "pkg.go.dev: https://pkg.go.dev/${MODULE}@v${VERSION} · implements spec ${VERSION} ([SPEC.md](https://github.com/${GITHUB_REPOSITORY}/blob/${TAG}/spec/SPEC.md))"
} > "$RUNNER_TEMP/notes.md"
# The npm release (js-vX.Y.Z) stays "Latest"; don't touch that flag here.
gh release edit "$TAG" --notes-file "$RUNNER_TEMP/notes.md"
1 change: 1 addition & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
# The compare job diffs the crate against the built JS package.
- "js/src/**"
- "scripts/compare-ports.mjs"
- "scripts/lib/ports.mjs"
- ".github/workflows/rust.yml"

permissions:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
- "js/scripts/gen-data.ts"
- "js/src/data.generated.ts"
- "python/pyproject.toml"
- "rust/Cargo.toml"
- "go/data_gen.go"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "package.json"
Expand All @@ -34,13 +36,15 @@ jobs:
run: pnpm --filter @trackparse/fixture-gen test
- name: Port data codegen is up to date
run: pnpm --filter trackparse gen:data:check
- name: js, python, rust and spec versions are linked
- name: js, python, rust, go and spec versions are linked
run: |
js_version=$(node -p "require('./js/package.json').version")
py_version=$(python3 -c 'import tomllib; print(tomllib.load(open("python/pyproject.toml", "rb"))["project"]["version"])')
rs_version=$(python3 -c 'import tomllib; print(tomllib.load(open("rust/Cargo.toml", "rb"))["package"]["version"])')
go_version=$(sed -n 's/^const SpecVersion = "\([^"]*\)".*/\1/p' go/data_gen.go)
spec_version=$(cat spec/VERSION)
echo "js=$js_version python=$py_version rust=$rs_version spec=$spec_version"
echo "js=$js_version python=$py_version rust=$rs_version go=$go_version spec=$spec_version"
test "$js_version" = "$spec_version"
test "$py_version" = "$spec_version"
test "$rs_version" = "$spec_version"
test "$go_version" = "$spec_version"
Loading
Loading