Projects / minstd
minstd
Small Go stdlib shims. atomic, sync, http, net, and a few others.
Why
While writing simhttp I kept wanting a piece of the standard library I could read in one file. The shim is that file. It is the gap I actually hit, not a port of Go.
Diagrams
A solid outline is the path in the repo. A dashed outline is the alternative that shape is refusing.
http has a request, a response, a status, and a server. net splits Unix and Windows sockets. Each package is a hole from the simhttp work, tested with go test ./....
flowchart TD
gap["A hole hit while writing simhttp"]
pkg["One package"]
test["go test ./..."]
gap --> pkg --> test
class gap,pkg,test chosen
The packages are not drop-in replacements for the standard library. A shim that almost matches is worse than no shim, because the missing method is the one you call. These tests cover what the packages claim.
flowchart TD
q{How much of std to copy}
q -->|"the piece the HTTP stack needed"| shim["One shim"]
q -->|"a second standard library"| port["A full port"]
class shim chosen
class port rejected
Why this shape
One package per gap. http has a request, a response, a status, a server. net splits Unix and Windows sockets. This is not a stdlib replacement. Each package is one hole from the simhttp work, small enough to test on its own with go test ./....
Where it breaks
A shim that almost matches the standard library is worse than no shim, because the one missing method is the one you call. These packages are not drop-in replacements. go test ./... covers what they claim. They do not cover the standard library.