Mobsql: Development Guide
This development guide provides various pointers on local development. If something from this guide is missing feel free to add it. If you have a question regarding something on this guide, please open a ticket on the ticket tracker or send a note to the mailing list.
Profiling
- Set env var
MOBSQL_PPROF
to the file to write a pprof profile.
Ex:
export MOBSQL_PPROF=foo.pprof
./mobsql loadmdbgtfs -p '{"feed_ids": [767]}'
go tool pprof
> web
Regenerate CLI Documentation doc_cli.md
page
The CLI documentation page simply list each subcommand for the mobsql
binary and its usage. This is equivalent for each subcommand to running
the help text. As such, a generator script creates this page. Regenerate
the doc_cli.md
page as follows:
./scripts/generate_cliguide.sh > doc/doc_cli.md
Regenerate the master mobsql_lib.go
file
For end-users we provide the single package git.sr.ht/~mil/mobsql
from
which all public functionality is exposed. Types and functions in this
package are just aliased from constituent subpackages in api/
. Doing
this aliasing allows from a development standpoint subpackages to be in
completely distinct and isolated namespaces ensuring modularity.
Rather then manually aliasing all public functionality from each
subpackage, we use a generator script to create the master library
file. Regenerate the master mobsql_lib.go
file as follows:
./scripts/generate_mobsqllibgo.sh > mobsql_lib.go