go-server is a Go module of packages for building HTTP servers and their command-line clients. Applications import it:
go get github.com/mutablelogic/go-server| Package | Description |
|---|---|
pkg/cmd |
Command-line applications, with a server command, global flags and defaults which are kept between commands |
pkg/httpserver |
The HTTP server, with its timeouts |
pkg/httprouter |
The router, with cross-origin requests, and an OpenAPI specification of its paths |
pkg/httprequest |
Reading requests: JSON, forms, queries, and files streamed from the request |
pkg/httpresponse |
Writing responses: JSON, errors, streams, and files, with their caching and preconditions |
pkg/jsonschema |
JSON schemas of Go types, and validating JSON with them |
pkg/openapi |
OpenAPI specifications, and their documentation in markdown |
pkg/otel |
OpenTelemetry tracing |
pkg/logger |
Structured logging |
pkg/tui |
Tables and other output for terminals |
pkg/types |
Common types, such as files, content types and headers |
pkg/version |
The version of a build |
You need Go, the version in go.mod, and Make.
| Target | Description |
|---|---|
make test |
Runs go vet, and the unit and coverage tests |
make vet |
Runs go vet |
make unit-test |
Runs the unit tests, verbosely with VERBOSE=1 |
make race-test |
Runs the unit tests with the race detector |
make coverage-test |
Reports the tests' coverage |
make tidy |
Runs go mod tidy |
make clean |
Removes the build directory |
The tests run in GitHub Actions for pull requests and pushes to main on Linux, and for releases on Windows and macOS too.