Repository navigation
feat(go): codeupipe for Go, the fourth runtime - #27
Merged
Merged
Conversation
packages/codeupipe-go is the Go runtime, written to conformance/API.md with no dependencies. A Filter, Predicate, Tap and Hook take a context.Context first and the data second. Payload is the default; each primitive also has a generic form (FilterOf[P]) for a type of your own, and the short name is the same type. What the contract refuses is a compile error: a function as a step, a Tap that is a Filter, AddValve with its arguments in the wrong order, a step for another type. refused_test.go builds each shape and checks the error. Tests are ported from packages/codeupipe-ts, with the ones that only Go can express: ctx reaches each step, 50 runs in goroutines keep their own State, and a nil step is refused when it is added. go test -race, go vet, gofmt and staticcheck are clean on Go 1.22.12 and 1.25.0. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
go:run passes all 30 conformance cases, with nothing unsupported, and every other target still passes in the same run of conformance/run.py. - conformance/runners/go: the runner, with one file for each step type in cup_ops/, named as the TypeScript and Rust runners name them. It reads and writes JSON with encoding/json, and runs with GOPROXY=off. - run.py and bench.py: the go:run target. Go is left out of a run on a machine with no go. The Go baseline is kept under its own key. - CI: a go job for gofmt, vet, staticcheck, go test -race, the example, go:run, and the tests again on Go 1.22. - conformance/API.md: a Go column and notes. Also fixes a sentence that was cut in the Rust notes (since #18). - MATRIX.md and BENCH.md regenerated from these runs. - docs/go-plan.md: the plan, with its decisions and the two phases. Checked by breaking the runtime on purpose: not recording a Tap failure fails 4 cases; keeping the State of a run that did not start last fails 1; not sending OnError for the pipeline fails 2. Benchmark, Apple Silicon: a 10-step run takes 0.55 µs for Go, 0.28 for Rust, 4.8 for python:run. Sizing the executed list once in State took 10 no-op steps from 356 to 217 ns. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Go runtime,
packages/codeupipe-go, written to the contract inconformance/API.md. It has no dependencies, and it passes all 30conformance cases (
python conformance/run.py go:run).Payload,Filter,Predicate,Valve(
AddValve),Tap,Hook,StateandPipeline. Each step method andRuntake acontext.Contextfirst. The Pipeline gives it to each stepand does nothing else with it.
FilterOf[P]andPipelineOf[P].FilterisFilterOf[*Payload], so itis the same type, not a second one.
AddValvewith its arguments in the wrong order, and a step for anothertype do not compile.
refused_test.gobuilds each shape and checks theerror.
conformance/runners/go/, with one file foreach step type. It reads JSON with
encoding/jsonand runs withGOPROXY=off.run.pyandbench.pyhave ago:runtarget. A machine with nogoleaves it out. The Go benchmark baseline has its own key.
gojob for gofmt, vet, staticcheck,go test -race, theexample,
go:run, and the tests on Go 1.22.conformance/API.mdhas a Go column and notes. It also fixes asentence that was cut in its Rust notes (from A Rust runtime, written to the contract #18).
MATRIX.mdandBENCH.mdare regenerated.docs/go-plan.mdhas the plan and itsdecisions.
How it is checked
go test -race ./...,go vet,gofmtandstaticcheckare clean on Go1.22.12 and 1.25.0.
suite passes (581 tests).
fail. With the State of a run that did not start last kept, 1 case fails.
With
OnErrornot sent for the pipeline, 2 cases fail.Not in this PR
main.Benchmark
Apple Silicon, µs per run. Lower is better.
The numbers are a snapshot. CI measures them and does not compare them.
🤖 Generated with Claude Code