golang.org/x/sync/semaphore — validation proof
Go’s own golang.org/x/sync/semaphore test suite, converted to C# by go2cs, built against the converted standard
library, run under the Go-semantics test host, and compared verdict for verdict against a clean
go test -json baseline of the same sources. This page is generated by the converter from that
comparison, and written beside the conversion: it is not a row of go2cs’s standard-library roster.
Validated 2026-11-09
7 matched · 1 disclosed — Go 1.26.10, linux/amd64, converted package
src/golang.org/x/sync/semaphore.
Measured at Release (tiered JIT off), oracle go version go1.26.10 linux/amd64, with no controlling terminal.
Both sides were built with -tags purego,math_big_pure_go,safe.
Input digest sha256-2280fe09cdcddd438df847fa7e122834cbcb397190c4ac3cd9cc1ed3c2e963f6: the package’s Go sources, conversion options, target and converter, as its
project records them (GoInputDigest).
Verdicts
| Test | go test |
go2cs |
|---|---|---|
TestAllocCancelDoesntStarve |
pass | pass |
TestLargeAcquireDoesntStarve |
pass | pass |
TestWeighted |
pass | pass |
TestWeightedAcquire |
pass | fail (disclosed) |
TestWeightedAcquireCanceled |
pass | pass |
TestWeightedDoesntBlockIfTooBig |
pass | pass |
TestWeightedPanic |
pass | pass |
TestWeightedTryAcquire |
pass | pass |
Disclosed divergences
A disclosed divergence is a specific Go assertion the managed CLR provably cannot satisfy — not
a skipped test and not a tolerance. Each one is pinned by exact failure signature in the package’s
hand-owned go2cs_test_disclosures.json;
a disclosed test that fails any other way is still a hard mismatch.
| Test | Class | Pinned reason |
|---|---|---|
TestWeightedAcquire |
runtime-capability |
runtime-capability: the test gives each tryAcquire call a 10 ms context deadline. The go2cs test host runs Release builds with tiered compilation off by default, so the FIRST call compiles the Acquire path at full optimization before its select runs. On the machine that measured it (linux/amd64, 4 cores) that takes longer than 10 ms, so ctx.Done() is already closed: tries[0] reads false, and the second, already-compiled call reads true (tries[1]). The converted code is faithful (in semaphore_test.cs, ctx is never reassigned). With tiered compilation on (-test-tiered), on the same machine with the same converter, semaphore matches 8 of 8 tests and the module 28, the count also measured on windows/amd64, so the difference is the first call’s compile time, not the conversion. Measured in 2 of 2 runs with tiering off. On a faster machine that passes the test, this entry is reported as orphaned, which changes nothing: the package still validates. This entry is removed if the test host warms up or tiers first calls. |
Excluded declarations
Declarations filtered from both sides of the comparison, and therefore not claimed above:
Benchmark, Fuzz and Example declarations the converted host does not execute, plus any
test requiring a capability the managed runtime does not provide — a testing member the host
has not implemented, or a platform behavior it provably cannot reproduce. Each is named with
the capability it needs.
- BenchmarkAcquireSeq (benchmark): benchmark execution is deferred to Phase 4D
- BenchmarkNewSeq (benchmark): benchmark execution is deferred to Phase 4D
- Example_workerPool (example): example execution is deferred to Phase 4D