ref: Reimplement v23cmd without a global map.

Bogdan pointed out that there's no need for a global map in
v23cmd - we can simply attach the run(ctx, env, args) function to
the runner that we're returning from RunnerFunc.  That's a nice
simplification.

We can also attach the init function to the runner as well.  I
objected to the init function in a previous approach because it
was a global variable in the v23cmd package, but there's no
downside if we attach it to the runner itself.

Note that there's no way to change the init function after a
runner has been created.  This is on purpose; RunnerFuncWithInit
is meant to be called in non-testing code, where there is no need
to change the init function.  It's a bit weird if we allowed the
init function to be changed, even if only in tests, since we'd be
changing the actual runner, which might impact other tests.

Also renamed v23cmd.ParseAndRun to ParseAndRunForTest, to make it
more obvious that it shouldn't be called in non-testing code, and
also so that it looks more different from cmdline.ParseAndRun.

Change-Id: Ifb59ca0300b670e2ab24554f880000478e5320b7
12 files changed
tree: c9915581603ff98146f4a412f0624cd759e8a34c
  1. cmd/
  2. envvar/
  3. examples/
  4. internal/
  5. lib/
  6. runtime/
  7. services/
  8. test/
  9. .gitignore
  10. AUTHORS
  11. CONTRIBUTORS
  12. LICENSE
  13. PATENTS
  14. README.md
  15. VERSION
README.md

Vanadium

This repository contains a reference implementation of the Vanadium APIs.

Unlike the APIs in https://github.com/vanadium/go.v23, which promises to provide backward compatibility this repository makes no such promises.