government

commit 27e33aecf4976d7646339e35c5fff6755a29497c

tree

parent:
69e3ad85cc0f4df2aca759df28acafb505578821

nmyk <nick@nmyk.io>

2026-11-14T23:06:18-05:00

move Go code into /src

diff --git a/DESIGN.md b/DESIGN.md
index 55c812aa686443a94be0f19a58d54a90af149e50..fdd698e772983743a34a7ff3043e6e6315e00fa1 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -291,7 +291,7 @@ A runtime error stops the program with exit code 1. Every error names its source location, which is an OID: `E-UNBOUND: no statute for symbol x at GOV.1.12.120 (depth 4)`. Ratification and decode errors use exit code 2.
 
 ## Interpreter architecture
 
-The interpreter is a pure-Go module that needs Go 1.24 or later. The language packages use only the standard library: `crypto/x509` for parsing and signatures, with path and policy processing implemented here. The two commands add [cobra](https://github.com/spf13/cobra) for the CLI, and `govlisp`'s REPL adds [ergochat/readline](https://github.com/ergochat/readline).
+The interpreter is a pure-Go module that needs Go 1.24 or later. The module root is `src/`, so the repository's top level holds only documents, `examples/`, `scripts/` and the Makefile, which runs every Go command in `src/`. The language packages use only the standard library: `crypto/x509` for parsing and signatures, with path and policy processing implemented here. The two commands add [cobra](https://github.com/spf13/cobra) for the CLI, and `govlisp`'s REPL adds [ergochat/readline](https://github.com/ergochat/readline).
 
 ### Go facts verified locally (go1.24.7)
 
@@ -378,7 +378,7 @@
 After a top-level form, `;=> value` asserts its printed value, and `;=! text` asserts an error whose message contains `text`. In test mode, an error ends only that form, so one file can hold many error cases.
 
 ```lisp
-; internal/lisptest/testdata/scoping.gov.lisp  (lexical, not dynamic)
+; src/internal/lisptest/testdata/scoping.gov.lisp  (lexical, not dynamic)
 (define x 1)
 (define f (lambda () x))
 (define g (lambda (x) (f)))
@@ -387,14 +387,14 @@ (define x 2)          ;=! immutable
 ((lambda (x) (define y (+ x 1)) (define z (+ y 1)) z) 1)   ;=> 3
 ((lambda () (define a (lambda () (b))) (define b (lambda () 1)) (a)))   ;=! unbound
 
-; internal/lisptest/testdata/truthiness.gov.lisp
+; src/internal/lisptest/testdata/truthiness.gov.lisp
 (and F (car '()))     ;=> F
 (or F 7)              ;=> 7
 (if 0 'true 'false)   ;=> true
 (if F 1)              ;=> ()
 (not 0)               ;=> F
 
-; internal/lisptest/testdata/strings.gov.lisp
+; src/internal/lisptest/testdata/strings.gov.lisp
 (strlen "héllo")        ;=> 5
 (strcat "gov" "ern" "ment")   ;=> "government"
 (str? "")             ;=> T
@@ -405,13 +405,13 @@ ### Test categories
 
 | Category | Form | Checks |
 | --- | --- | --- |
-| Language | `internal/lisptest/testdata/*.gov.lisp`, listed by `lisptest.Files` | All semantics: arithmetic, comparisons, truthiness, `if`, `quote`, lists, `define`, closures, scoping, recursion, higher-order functions, strings and Unicode |
-| Shape stress | `stress_test.go`, generated | 200-deep nesting (201 certs), 1,000-argument calls, 1,000-element `quote`d lists, 1,000 top-level forms, all through the whole pipeline; `--max-nodes` exactly at and one below a program's graph size; a small file asking for a million-node graph, refused quickly. Shared subexpressions are in `lisp2gov/share_test.go` |
+| Language | `src/internal/lisptest/testdata/*.gov.lisp`, listed by `lisptest.Files` | All semantics: arithmetic, comparisons, truthiness, `if`, `quote`, lists, `define`, closures, scoping, recursion, higher-order functions, strings and Unicode |
+| Shape stress | `src/stress_test.go`, generated | 200-deep nesting (201 certs), 1,000-argument calls, 1,000-element `quote`d lists, 1,000 top-level forms, all through the whole pipeline; `--max-nodes` exactly at and one below a program's graph size; a small file asking for a million-node graph, refused quickly. Shared subexpressions are in `src/lisp2gov/share_test.go` |
 | Round trip | Go test over every language test program | `gov2lisp(lisp2gov(src))` equals the normalized source, comments included |
 | Ratification | Go table test that mutates a valid chain | Flipped signature byte, reordered certs, dropped mapping, orphaned policy, mapping in cert n, `anyPolicy` missing from a cert 2..n or asserted in cert 1, a list node with no elements, unknown critical extension; each expects a specific error |
 | Civic | Go table test | Runs before, inside and after a `--not-before`/`--not-after` window; repeal of each depth; scheduled repeal; stale CRL; CRL signed by the wrong key; `--anchor` pin across a re-ratified version; notes over 200 characters; default-key warning |
-| Golden | `lisp2gov/testdata/golden.gov` and `golden.crl`, from `golden.gov.lisp` | Byte equality with every option fixed (seed, author, dates), so any change to the encoding fails, reported as the block and DER byte where it starts; the program uses every literal kind, a split note, a dotted pair and a shared node, and must also run. `go test ./lisp2gov -update` accepts a deliberate change |
-| External oracle (optional) | `lisp2gov/openssl_test.go`: `openssl verify -x509_strict -policy_check -explicit_policy -policy 2.5.29.32.0 -policy_print`, plus `-crl_check_all` with repeal CRLs | OpenSSL accepts every test program and example, shared and not, and reports the same top-level policies; it refuses each broken program (tampered, missing depth, foreign anchor, out of force) and each repealed one. Three known disagreements are pinned: scheduled repeals, a list issued after the check time, and OpenSSL's 1,000-node tree limit (see OpenSSL below). Skipped without OpenSSL; `$GOVERNMENT_OPENSSL` picks the binary, since macOS's `openssl` is LibreSSL. `make oracle` runs them with an OpenSSL built without its tree limit. Without `-policy 2.5.29.32.0` OpenSSL treats the acceptable set as empty |
+| Golden | `src/lisp2gov/testdata/golden.gov` and `golden.crl`, from `golden.gov.lisp` | Byte equality with every option fixed (seed, author, dates), so any change to the encoding fails, reported as the block and DER byte where it starts; the program uses every literal kind, a split note, a dotted pair and a shared node, and must also run. `go test ./lisp2gov -update`, run in `src/`, accepts a deliberate change |
+| External oracle (optional) | `src/lisp2gov/openssl_test.go`: `openssl verify -x509_strict -policy_check -explicit_policy -policy 2.5.29.32.0 -policy_print`, plus `-crl_check_all` with repeal CRLs | OpenSSL accepts every test program and example, shared and not, and reports the same top-level policies; it refuses each broken program (tampered, missing depth, foreign anchor, out of force) and each repealed one. Three known disagreements are pinned: scheduled repeals, a list issued after the check time, and OpenSSL's 1,000-node tree limit (see OpenSSL below). Skipped without OpenSSL; `$GOVERNMENT_OPENSSL` picks the binary, since macOS's `openssl` is LibreSSL. `make oracle` runs them with an OpenSSL built without its tree limit. Without `-policy 2.5.29.32.0` OpenSSL treats the acceptable set as empty |
 
 Ratification tests are Go rather than Lisp because a Lisp source cannot express a broken certificate.
 
diff --git a/Makefile b/Makefile
index 845c97ba8c9b5cb0733bf5a9a4bbcff36440d2d5..6c563ad19b84125f866e5ca40bdd228d7f5ab33b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,24 +1,27 @@
-.PHONY: check test vet fmt bin install clean
+.PHONY: check test vet fmt bin install clean oracle
+
+# The Go module lives in src/; every Go command runs there.
+GO = cd src && go
 
 check: fmt vet test
 
 test:
-	go test ./...
+	$(GO) test ./...
 
 vet:
-	go vet ./...
+	$(GO) vet ./...
 
 fmt:
-	@unformatted="$$(gofmt -l .)"; \
+	@unformatted="$$(gofmt -l src)"; \
 	if [ -n "$$unformatted" ]; then echo "gofmt needed:"; echo "$$unformatted"; exit 1; fi
 
 # Build every command (government, govlisp) into ./bin.
 bin:
-	go build -o bin/ ./cmd/...
+	$(GO) build -o ../bin/ ./cmd/...
 
 # Install every command into $(go env GOBIN), or $(go env GOPATH)/bin if unset.
 install:
-	go install ./cmd/...
+	$(GO) install ./cmd/...
 
 clean:
 	rm -rf bin
@@ -28,4 +31,4 @@ # limit removed, building that OpenSSL the first time (see
 # scripts/openssl-unlimited.sh). The ordinary tests use whatever openssl is
 # installed, limit and all.
 oracle:
-	@bin=$$(scripts/openssl-unlimited.sh) && GOVERNMENT_OPENSSL=$$bin go test ./lisp2gov -run OpenSSL -count=1 -v
\ No newline at end of file
+	@bin=$$(scripts/openssl-unlimited.sh) && cd src && GOVERNMENT_OPENSSL=$$bin go test ./lisp2gov -run OpenSSL -count=1 -v
\ No newline at end of file
diff --git a/README.md b/README.md
index a128894b2cb67ecde470ff4a97add04905537695..b918401795caec8b7c77141fbcff9aa3ec7650cd 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,9 @@ 1. Clone the repository.
 2. In its root directory, run `make bin` to build the commands into `./bin`, or
    `make install` to install them.
 
+The Go code lives in `src/`, which is the module root; the Makefile runs every
+Go command there.
+
 There are two commands:
 
 - `government` compiles, checks, inspects, runs and repeals `.gov` files.
@@ -322,16 +325,16 @@ A form can span several lines, and an error does not end the session.
 
 ## Tests
 
-| Command                      | Does                                                                               |
-| ---------------------------- | ---------------------------------------------------------------------------------- |
-| `make check`                 | Runs `gofmt`, `go vet` and every test.                                             |
-| `go test -short ./...`       | Runs every test except the largest shared-subexpression one.                       |
-| `go test ./lisp2gov -update` | Rewrites the golden files. Use it only for a deliberate change to the file format. |
-| `make oracle`                | Builds an OpenSSL without its policy tree limit, and checks GOVERNMENT against it. |
+| Command                                | Does                                                                               |
+| -------------------------------------- | ---------------------------------------------------------------------------------- |
+| `make check`                           | Runs `gofmt`, `go vet` and every test.                                             |
+| `cd src && go test -short ./...`       | Runs every test except the largest shared-subexpression one.                       |
+| `cd src && go test ./lisp2gov -update` | Rewrites the golden files. Use it only for a deliberate change to the file format. |
+| `make oracle`                          | Builds an OpenSSL without its policy tree limit, and checks GOVERNMENT against it. |
 
-Each program in `internal/lisptest/testdata/` is a GovLisp file: a `;=>` comment
-gives a form's expected value, and `;=!` its expected error. The tests compile
-each file and run it through the whole interpreter.
+Each program in `src/internal/lisptest/testdata/` is a GovLisp file: a `;=>`
+comment gives a form's expected value, and `;=!` its expected error. The tests
+compile each file and run it through the whole interpreter.
 
 The OpenSSL tests use the `openssl` command. On macOS that is often LibreSSL,
 and the tests skip. Set `GOVERNMENT_OPENSSL` to the path of an OpenSSL binary to
diff --git a/ast/builtin.go b/src/ast/builtin.go
rename from ast/builtin.go
rename to src/ast/builtin.go
diff --git a/ast/doc.go b/src/ast/doc.go
rename from ast/doc.go
rename to src/ast/doc.go
diff --git a/ast/layer.go b/src/ast/layer.go
rename from ast/layer.go
rename to src/ast/layer.go
diff --git a/ast/layer_test.go b/src/ast/layer_test.go
rename from ast/layer_test.go
rename to src/ast/layer_test.go
diff --git a/ast/oid.go b/src/ast/oid.go
rename from ast/oid.go
rename to src/ast/oid.go
diff --git a/ast/oid_test.go b/src/ast/oid_test.go
rename from ast/oid_test.go
rename to src/ast/oid_test.go
diff --git a/ast/share.go b/src/ast/share.go
rename from ast/share.go
rename to src/ast/share.go
diff --git a/ast/share_test.go b/src/ast/share_test.go
rename from ast/share_test.go
rename to src/ast/share_test.go
index b17133594889e528a325ff1d4efeea4d04bdce64..3cfcaad6f4bd4f59f53c79b675b04f3736005e8a 100644
--- a/ast/share_test.go
+++ b/src/ast/share_test.go
@@ -170,7 +170,7 @@ // TestShareTestdata runs Share over every test program, which between them
 // repeat plenty of subexpressions.
 func TestShareTestdata(t *testing.T) {
 	paths, _ := lisptest.Files()
-	examples, _ := filepath.Glob("../examples/*.gov.lisp")
+	examples, _ := lisptest.Examples()
 	for _, path := range append(paths, examples...) {
 		src, err := os.ReadFile(path)
 		if err != nil {
diff --git a/ast/tree.go b/src/ast/tree.go
rename from ast/tree.go
rename to src/ast/tree.go
diff --git a/ast/tree_test.go b/src/ast/tree_test.go
rename from ast/tree_test.go
rename to src/ast/tree_test.go
index 35764e9e35e7caa64e72f05ce5f5bd7c0d015c91..9507ddf32fa7537dd87d28b5c6db3a4571348f75 100644
--- a/ast/tree_test.go
+++ b/src/ast/tree_test.go
@@ -2,7 +2,6 @@ package ast
 
 import (
 	"os"
-	"path/filepath"
 	"reflect"
 	"strconv"
 	"strings"
@@ -266,7 +265,7 @@ // mean the reader splits some list differently from DatumOf.
 func TestBuildMatchesToTree(t *testing.T) {
 	sources := []string{`'(1 . (2 . (3 . ())))`, `'(a . 'b)`, `'(a b . c)`, `(f () T F "s" 1.5 -2)`, `'''x`}
 	files, _ := lisptest.Files()
-	examples, _ := filepath.Glob("../examples/*.gov.lisp")
+	examples, _ := lisptest.Examples()
 	for _, f := range append(files, examples...) {
 		src, err := os.ReadFile(f)
 		if err != nil {
diff --git a/ast/unlayer.go b/src/ast/unlayer.go
rename from ast/unlayer.go
rename to src/ast/unlayer.go
diff --git a/ast/unlayer_test.go b/src/ast/unlayer_test.go
rename from ast/unlayer_test.go
rename to src/ast/unlayer_test.go
diff --git a/builtin/builtin.go b/src/builtin/builtin.go
rename from builtin/builtin.go
rename to src/builtin/builtin.go
diff --git a/builtin/builtin_test.go b/src/builtin/builtin_test.go
rename from builtin/builtin_test.go
rename to src/builtin/builtin_test.go
diff --git a/cmd/government/anchor.go b/src/cmd/government/anchor.go
rename from cmd/government/anchor.go
rename to src/cmd/government/anchor.go
diff --git a/cmd/government/anchor_test.go b/src/cmd/government/anchor_test.go
rename from cmd/government/anchor_test.go
rename to src/cmd/government/anchor_test.go
diff --git a/cmd/government/at.go b/src/cmd/government/at.go
rename from cmd/government/at.go
rename to src/cmd/government/at.go
diff --git a/cmd/government/at_test.go b/src/cmd/government/at_test.go
rename from cmd/government/at_test.go
rename to src/cmd/government/at_test.go
diff --git a/cmd/government/author_test.go b/src/cmd/government/author_test.go
rename from cmd/government/author_test.go
rename to src/cmd/government/author_test.go
diff --git a/cmd/government/compile.go b/src/cmd/government/compile.go
rename from cmd/government/compile.go
rename to src/cmd/government/compile.go
diff --git a/cmd/government/examples_test.go b/src/cmd/government/examples_test.go
rename from cmd/government/examples_test.go
rename to src/cmd/government/examples_test.go
index c543117fb9fb33eab9d7c895af14bbab949b6048..afb0eb52b9b7882db85bcde2c071b125e110df45 100644
--- a/cmd/government/examples_test.go
+++ b/src/cmd/government/examples_test.go
@@ -3,6 +3,8 @@
 import (
 	"path/filepath"
 	"testing"
+
+	"government/internal/lisptest"
 )
 
 // TestExamples compiles and runs every program in examples/ and checks its
@@ -16,7 +18,7 @@ 		"fibonacci": "6765\n6765\n7540113804746346429\n",
 		"hanoi": "((left right) (left middle) (right middle) (left right) (middle left) (middle right) (left right))\n" +
 			"1023\n",
 	}
-	files, err := filepath.Glob("../../examples/*.gov.lisp")
+	files, err := lisptest.Examples()
 	if err != nil {
 		t.Fatal(err)
 	}
diff --git a/cmd/government/inspect.go b/src/cmd/government/inspect.go
rename from cmd/government/inspect.go
rename to src/cmd/government/inspect.go
diff --git a/cmd/government/inspect_test.go b/src/cmd/government/inspect_test.go
rename from cmd/government/inspect_test.go
rename to src/cmd/government/inspect_test.go
diff --git a/cmd/government/load.go b/src/cmd/government/load.go
rename from cmd/government/load.go
rename to src/cmd/government/load.go
diff --git a/cmd/government/main.go b/src/cmd/government/main.go
rename from cmd/government/main.go
rename to src/cmd/government/main.go
diff --git a/cmd/government/main_test.go b/src/cmd/government/main_test.go
rename from cmd/government/main_test.go
rename to src/cmd/government/main_test.go
diff --git a/cmd/government/repeal.go b/src/cmd/government/repeal.go
rename from cmd/government/repeal.go
rename to src/cmd/government/repeal.go
diff --git a/cmd/government/repeal_test.go b/src/cmd/government/repeal_test.go
rename from cmd/government/repeal_test.go
rename to src/cmd/government/repeal_test.go
diff --git a/cmd/government/run.go b/src/cmd/government/run.go
rename from cmd/government/run.go
rename to src/cmd/government/run.go
diff --git a/cmd/government/run_test.go b/src/cmd/government/run_test.go
rename from cmd/government/run_test.go
rename to src/cmd/government/run_test.go
diff --git a/cmd/government/verify.go b/src/cmd/government/verify.go
rename from cmd/government/verify.go
rename to src/cmd/government/verify.go
diff --git a/cmd/government/verify_test.go b/src/cmd/government/verify_test.go
rename from cmd/government/verify_test.go
rename to src/cmd/government/verify_test.go
diff --git a/cmd/govlisp/lines.go b/src/cmd/govlisp/lines.go
rename from cmd/govlisp/lines.go
rename to src/cmd/govlisp/lines.go
diff --git a/cmd/govlisp/main.go b/src/cmd/govlisp/main.go
rename from cmd/govlisp/main.go
rename to src/cmd/govlisp/main.go
diff --git a/cmd/govlisp/main_test.go b/src/cmd/govlisp/main_test.go
rename from cmd/govlisp/main_test.go
rename to src/cmd/govlisp/main_test.go
diff --git a/cmd/govlisp/readline_test.go b/src/cmd/govlisp/readline_test.go
rename from cmd/govlisp/readline_test.go
rename to src/cmd/govlisp/readline_test.go
diff --git a/cmd/govlisp/repl.go b/src/cmd/govlisp/repl.go
rename from cmd/govlisp/repl.go
rename to src/cmd/govlisp/repl.go
diff --git a/eval/arith.go b/src/eval/arith.go
rename from eval/arith.go
rename to src/eval/arith.go
diff --git a/eval/arith_test.go b/src/eval/arith_test.go
rename from eval/arith_test.go
rename to src/eval/arith_test.go
diff --git a/eval/builtin.go b/src/eval/builtin.go
rename from eval/builtin.go
rename to src/eval/builtin.go
diff --git a/eval/closure.go b/src/eval/closure.go
rename from eval/closure.go
rename to src/eval/closure.go
diff --git a/eval/closure_test.go b/src/eval/closure_test.go
rename from eval/closure_test.go
rename to src/eval/closure_test.go
diff --git a/eval/compare.go b/src/eval/compare.go
rename from eval/compare.go
rename to src/eval/compare.go
diff --git a/eval/compare_test.go b/src/eval/compare_test.go
rename from eval/compare_test.go
rename to src/eval/compare_test.go
diff --git a/eval/define.go b/src/eval/define.go
rename from eval/define.go
rename to src/eval/define.go
diff --git a/eval/define_test.go b/src/eval/define_test.go
rename from eval/define_test.go
rename to src/eval/define_test.go
diff --git a/eval/doc.go b/src/eval/doc.go
rename from eval/doc.go
rename to src/eval/doc.go
diff --git a/eval/env.go b/src/eval/env.go
rename from eval/env.go
rename to src/eval/env.go
diff --git a/eval/env_test.go b/src/eval/env_test.go
rename from eval/env_test.go
rename to src/eval/env_test.go
diff --git a/eval/error.go b/src/eval/error.go
rename from eval/error.go
rename to src/eval/error.go
diff --git a/eval/error_test.go b/src/eval/error_test.go
rename from eval/error_test.go
rename to src/eval/error_test.go
diff --git a/eval/eval.go b/src/eval/eval.go
rename from eval/eval.go
rename to src/eval/eval.go
diff --git a/eval/eval_test.go b/src/eval/eval_test.go
rename from eval/eval_test.go
rename to src/eval/eval_test.go
diff --git a/eval/function_test.go b/src/eval/function_test.go
rename from eval/function_test.go
rename to src/eval/function_test.go
diff --git a/eval/lists.go b/src/eval/lists.go
rename from eval/lists.go
rename to src/eval/lists.go
diff --git a/eval/lists_test.go b/src/eval/lists_test.go
rename from eval/lists_test.go
rename to src/eval/lists_test.go
diff --git a/eval/logic.go b/src/eval/logic.go
rename from eval/logic.go
rename to src/eval/logic.go
diff --git a/eval/logic_test.go b/src/eval/logic_test.go
rename from eval/logic_test.go
rename to src/eval/logic_test.go
diff --git a/eval/tail_test.go b/src/eval/tail_test.go
rename from eval/tail_test.go
rename to src/eval/tail_test.go
diff --git a/go.mod b/src/go.mod
rename from go.mod
rename to src/go.mod
diff --git a/go.sum b/src/go.sum
rename from go.sum
rename to src/go.sum
diff --git a/gov2lisp/gov2lisp.go b/src/gov2lisp/gov2lisp.go
rename from gov2lisp/gov2lisp.go
rename to src/gov2lisp/gov2lisp.go
diff --git a/gov2lisp/gov2lisp_test.go b/src/gov2lisp/gov2lisp_test.go
rename from gov2lisp/gov2lisp_test.go
rename to src/gov2lisp/gov2lisp_test.go
index a738cc3d7afddc588cb3a1be481d6bf5e71b9a23..25cab2fa193b201ee4a709674e24bab7c1590f9a 100644
--- a/gov2lisp/gov2lisp_test.go
+++ b/src/gov2lisp/gov2lisp_test.go
@@ -2,7 +2,6 @@ package gov2lisp
 
 import (
 	"os"
-	"path/filepath"
 	"reflect"
 	"strings"
 	"testing"
@@ -35,7 +34,7 @@ // reading the source and printing the decoded program shows up here, in
 // either direction.
 func TestRoundTrip(t *testing.T) {
 	files, _ := lisptest.Files()
-	examples, _ := filepath.Glob("../examples/*.gov.lisp")
+	examples, _ := lisptest.Examples()
 	files = append(files, examples...)
 	if len(files) == 0 {
 		t.Fatal("no programs found")
diff --git a/internal/der/der.go b/src/internal/der/der.go
rename from internal/der/der.go
rename to src/internal/der/der.go
diff --git a/internal/der/der_test.go b/src/internal/der/der_test.go
rename from internal/der/der_test.go
rename to src/internal/der/der_test.go
diff --git a/internal/lisptest/lisptest.go b/src/internal/lisptest/lisptest.go
rename from internal/lisptest/lisptest.go
rename to src/internal/lisptest/lisptest.go
index 377c6b8ff81fb920782685624c4845722b5bc257..93f9451613d034dca8eb6f1222b5c54ff9310f68 100644
--- a/internal/lisptest/lisptest.go
+++ b/src/internal/lisptest/lisptest.go
@@ -171,17 +171,29 @@ }
 
 // Files returns the paths of the language test programs, the
 // testdata/*.gov.lisp files beside this package, so every package's tests
-// can run them without knowing where they live. It finds them through
-// this source file's path, which is only right when tests run from
-// source, as go test does.
+// can run them without knowing where they live.
 func Files() ([]string, error) {
+	return glob("testdata")
+}
+
+// Examples returns the paths of the example programs in the repository's
+// top-level examples directory.
+func Examples() ([]string, error) {
+	return glob("..", "..", "..", "examples")
+}
+
+// glob lists the .gov.lisp files in a directory given relative to this
+// package. It finds the package through this source file's path, which
+// is only right when tests run from source, as go test does.
+func glob(dir ...string) ([]string, error) {
 	_, self, _, ok := runtime.Caller(0)
 	if !ok {
 		return nil, fmt.Errorf("lisptest: cannot find its own source")
 	}
-	paths, err := filepath.Glob(filepath.Join(filepath.Dir(self), "testdata", "*.gov.lisp"))
+	d := filepath.Join(append([]string{filepath.Dir(self)}, dir...)...)
+	paths, err := filepath.Glob(filepath.Join(d, "*.gov.lisp"))
 	if err == nil && len(paths) == 0 {
-		err = fmt.Errorf("lisptest: no test programs in %s", filepath.Join(filepath.Dir(self), "testdata"))
+		err = fmt.Errorf("lisptest: no programs in %s", d)
 	}
 	return paths, err
 }
diff --git a/internal/lisptest/lisptest_test.go b/src/internal/lisptest/lisptest_test.go
rename from internal/lisptest/lisptest_test.go
rename to src/internal/lisptest/lisptest_test.go
diff --git a/internal/lisptest/testdata/arithmetic.gov.lisp b/src/internal/lisptest/testdata/arithmetic.gov.lisp
rename from internal/lisptest/testdata/arithmetic.gov.lisp
rename to src/internal/lisptest/testdata/arithmetic.gov.lisp
diff --git a/internal/lisptest/testdata/comparison.gov.lisp b/src/internal/lisptest/testdata/comparison.gov.lisp
rename from internal/lisptest/testdata/comparison.gov.lisp
rename to src/internal/lisptest/testdata/comparison.gov.lisp
diff --git a/internal/lisptest/testdata/functions.gov.lisp b/src/internal/lisptest/testdata/functions.gov.lisp
rename from internal/lisptest/testdata/functions.gov.lisp
rename to src/internal/lisptest/testdata/functions.gov.lisp
diff --git a/internal/lisptest/testdata/lists.gov.lisp b/src/internal/lisptest/testdata/lists.gov.lisp
rename from internal/lisptest/testdata/lists.gov.lisp
rename to src/internal/lisptest/testdata/lists.gov.lisp
diff --git a/internal/lisptest/testdata/quote.gov.lisp b/src/internal/lisptest/testdata/quote.gov.lisp
rename from internal/lisptest/testdata/quote.gov.lisp
rename to src/internal/lisptest/testdata/quote.gov.lisp
diff --git a/internal/lisptest/testdata/recursion.gov.lisp b/src/internal/lisptest/testdata/recursion.gov.lisp
rename from internal/lisptest/testdata/recursion.gov.lisp
rename to src/internal/lisptest/testdata/recursion.gov.lisp
diff --git a/internal/lisptest/testdata/scoping.gov.lisp b/src/internal/lisptest/testdata/scoping.gov.lisp
rename from internal/lisptest/testdata/scoping.gov.lisp
rename to src/internal/lisptest/testdata/scoping.gov.lisp
diff --git a/internal/lisptest/testdata/strings.gov.lisp b/src/internal/lisptest/testdata/strings.gov.lisp
rename from internal/lisptest/testdata/strings.gov.lisp
rename to src/internal/lisptest/testdata/strings.gov.lisp
diff --git a/internal/lisptest/testdata/truthiness.gov.lisp b/src/internal/lisptest/testdata/truthiness.gov.lisp
rename from internal/lisptest/testdata/truthiness.gov.lisp
rename to src/internal/lisptest/testdata/truthiness.gov.lisp
diff --git a/lisp2gov/author_test.go b/src/lisp2gov/author_test.go
rename from lisp2gov/author_test.go
rename to src/lisp2gov/author_test.go
diff --git a/lisp2gov/cert.go b/src/lisp2gov/cert.go
rename from lisp2gov/cert.go
rename to src/lisp2gov/cert.go
diff --git a/lisp2gov/cert_test.go b/src/lisp2gov/cert_test.go
rename from lisp2gov/cert_test.go
rename to src/lisp2gov/cert_test.go
diff --git a/lisp2gov/compile.go b/src/lisp2gov/compile.go
rename from lisp2gov/compile.go
rename to src/lisp2gov/compile.go
diff --git a/lisp2gov/compile_test.go b/src/lisp2gov/compile_test.go
rename from lisp2gov/compile_test.go
rename to src/lisp2gov/compile_test.go
diff --git a/lisp2gov/doc.go b/src/lisp2gov/doc.go
rename from lisp2gov/doc.go
rename to src/lisp2gov/doc.go
diff --git a/lisp2gov/extensions.go b/src/lisp2gov/extensions.go
rename from lisp2gov/extensions.go
rename to src/lisp2gov/extensions.go
diff --git a/lisp2gov/extensions_test.go b/src/lisp2gov/extensions_test.go
rename from lisp2gov/extensions_test.go
rename to src/lisp2gov/extensions_test.go
diff --git a/lisp2gov/golden_test.go b/src/lisp2gov/golden_test.go
rename from lisp2gov/golden_test.go
rename to src/lisp2gov/golden_test.go
diff --git a/lisp2gov/keys.go b/src/lisp2gov/keys.go
rename from lisp2gov/keys.go
rename to src/lisp2gov/keys.go
diff --git a/lisp2gov/openssl_test.go b/src/lisp2gov/openssl_test.go
rename from lisp2gov/openssl_test.go
rename to src/lisp2gov/openssl_test.go
index 0fec4e8bc99653635a00fd02eaf8a46ba06e2de9..3f5c6d6784577288f676f174d52844f33b91ce6a 100644
--- a/lisp2gov/openssl_test.go
+++ b/src/lisp2gov/openssl_test.go
@@ -132,7 +132,7 @@ // top-level policies the first cert lists.
 func TestOpenSSLAcceptsEveryProgram(t *testing.T) {
 	needOpenSSL(t)
 	paths, _ := lisptest.Files()
-	examples, _ := filepath.Glob("../examples/*.gov.lisp")
+	examples, _ := lisptest.Examples()
 	paths = append(append(paths, examples...), "testdata/golden.gov.lisp")
 	at := time.Date(2028, 1, 1, 0, 0, 0, 0, time.UTC)
 	for _, path := range paths {
diff --git a/lisp2gov/repeal.go b/src/lisp2gov/repeal.go
rename from lisp2gov/repeal.go
rename to src/lisp2gov/repeal.go
diff --git a/lisp2gov/repeal_test.go b/src/lisp2gov/repeal_test.go
rename from lisp2gov/repeal_test.go
rename to src/lisp2gov/repeal_test.go
diff --git a/lisp2gov/share_test.go b/src/lisp2gov/share_test.go
rename from lisp2gov/share_test.go
rename to src/lisp2gov/share_test.go
diff --git a/lisp2gov/testdata/answer.gov b/src/lisp2gov/testdata/answer.gov
rename from lisp2gov/testdata/answer.gov
rename to src/lisp2gov/testdata/answer.gov
diff --git a/lisp2gov/testdata/golden.crl b/src/lisp2gov/testdata/golden.crl
rename from lisp2gov/testdata/golden.crl
rename to src/lisp2gov/testdata/golden.crl
diff --git a/lisp2gov/testdata/golden.gov b/src/lisp2gov/testdata/golden.gov
rename from lisp2gov/testdata/golden.gov
rename to src/lisp2gov/testdata/golden.gov
diff --git a/lisp2gov/testdata/golden.gov.lisp b/src/lisp2gov/testdata/golden.gov.lisp
rename from lisp2gov/testdata/golden.gov.lisp
rename to src/lisp2gov/testdata/golden.gov.lisp
diff --git a/lisp_test.go b/src/lisp_test.go
rename from lisp_test.go
rename to src/lisp_test.go
diff --git a/policy/doc.go b/src/policy/doc.go
rename from policy/doc.go
rename to src/policy/doc.go
diff --git a/policy/draw.go b/src/policy/draw.go
rename from policy/draw.go
rename to src/policy/draw.go
diff --git a/policy/draw_test.go b/src/policy/draw_test.go
rename from policy/draw_test.go
rename to src/policy/draw_test.go
diff --git a/policy/error.go b/src/policy/error.go
rename from policy/error.go
rename to src/policy/error.go
diff --git a/policy/graph.go b/src/policy/graph.go
rename from policy/graph.go
rename to src/policy/graph.go
diff --git a/policy/graph_test.go b/src/policy/graph_test.go
rename from policy/graph_test.go
rename to src/policy/graph_test.go
diff --git a/policy/layers.go b/src/policy/layers.go
rename from policy/layers.go
rename to src/policy/layers.go
diff --git a/policy/mapping_test.go b/src/policy/mapping_test.go
rename from policy/mapping_test.go
rename to src/policy/mapping_test.go
diff --git a/policy/notes.go b/src/policy/notes.go
rename from policy/notes.go
rename to src/policy/notes.go
diff --git a/policy/strict.go b/src/policy/strict.go
rename from policy/strict.go
rename to src/policy/strict.go
diff --git a/policy/strict_test.go b/src/policy/strict_test.go
rename from policy/strict_test.go
rename to src/policy/strict_test.go
index 4f02bf12feaae901c40e154b516a75bbc6be8dd4..fe8ddce17c85833e6eee249d2ccda54b8b066d5f 100644
--- a/policy/strict_test.go
+++ b/src/policy/strict_test.go
@@ -4,7 +4,6 @@ import (
 	"crypto/x509"
 	"errors"
 	"os"
-	"path/filepath"
 	"reflect"
 	"strings"
 	"testing"
@@ -63,7 +62,7 @@ }
 
 func TestTestdataDecodesToItsSource(t *testing.T) {
 	files, _ := lisptest.Files()
-	examples, _ := filepath.Glob("../examples/*.gov.lisp")
+	examples, _ := lisptest.Examples()
 	files = append(files, examples...)
 	for _, file := range files {
 		src, err := os.ReadFile(file)
diff --git a/program/program.go b/src/program/program.go
rename from program/program.go
rename to src/program/program.go
diff --git a/program/program_test.go b/src/program/program_test.go
rename from program/program_test.go
rename to src/program/program_test.go
diff --git a/ratify/anchor.go b/src/ratify/anchor.go
rename from ratify/anchor.go
rename to src/ratify/anchor.go
diff --git a/ratify/anchor_test.go b/src/ratify/anchor_test.go
rename from ratify/anchor_test.go
rename to src/ratify/anchor_test.go
diff --git a/ratify/chain.go b/src/ratify/chain.go
rename from ratify/chain.go
rename to src/ratify/chain.go
diff --git a/ratify/chain_test.go b/src/ratify/chain_test.go
rename from ratify/chain_test.go
rename to src/ratify/chain_test.go
diff --git a/ratify/doc.go b/src/ratify/doc.go
rename from ratify/doc.go
rename to src/ratify/doc.go
diff --git a/ratify/error.go b/src/ratify/error.go
rename from ratify/error.go
rename to src/ratify/error.go
diff --git a/ratify/load.go b/src/ratify/load.go
rename from ratify/load.go
rename to src/ratify/load.go
diff --git a/ratify/load_test.go b/src/ratify/load_test.go
rename from ratify/load_test.go
rename to src/ratify/load_test.go
index 765350b1e0be0d4a7cd8beba34b92d9a1e6110a9..d372515e1a933e4cae3f5738b0e170104d7717ec 100644
--- a/ratify/load_test.go
+++ b/src/ratify/load_test.go
@@ -8,7 +8,6 @@ 	"encoding/base64"
 	"encoding/pem"
 	"errors"
 	"os"
-	"path/filepath"
 	"strings"
 	"testing"
 
@@ -36,7 +35,7 @@ }
 
 func TestLoadCompiledPrograms(t *testing.T) {
 	files, _ := lisptest.Files()
-	examples, _ := filepath.Glob("../examples/*.gov.lisp")
+	examples, _ := lisptest.Examples()
 	files = append(files, examples...)
 	for _, file := range files {
 		src, err := os.ReadFile(file)
diff --git a/ratify/order.go b/src/ratify/order.go
rename from ratify/order.go
rename to src/ratify/order.go
diff --git a/ratify/ratify.go b/src/ratify/ratify.go
rename from ratify/ratify.go
rename to src/ratify/ratify.go
diff --git a/ratify/repeal.go b/src/ratify/repeal.go
rename from ratify/repeal.go
rename to src/ratify/repeal.go
diff --git a/ratify/repeal_test.go b/src/ratify/repeal_test.go
rename from ratify/repeal_test.go
rename to src/ratify/repeal_test.go
diff --git a/ratify/validity.go b/src/ratify/validity.go
rename from ratify/validity.go
rename to src/ratify/validity.go
diff --git a/ratify/validity_test.go b/src/ratify/validity_test.go
rename from ratify/validity_test.go
rename to src/ratify/validity_test.go
diff --git a/sexpr/datum.go b/src/sexpr/datum.go
rename from sexpr/datum.go
rename to src/sexpr/datum.go
diff --git a/sexpr/doc.go b/src/sexpr/doc.go
rename from sexpr/doc.go
rename to src/sexpr/doc.go
diff --git a/sexpr/notes.go b/src/sexpr/notes.go
rename from sexpr/notes.go
rename to src/sexpr/notes.go
diff --git a/sexpr/notes_test.go b/src/sexpr/notes_test.go
rename from sexpr/notes_test.go
rename to src/sexpr/notes_test.go
diff --git a/sexpr/print.go b/src/sexpr/print.go
rename from sexpr/print.go
rename to src/sexpr/print.go
diff --git a/sexpr/print_test.go b/src/sexpr/print_test.go
rename from sexpr/print_test.go
rename to src/sexpr/print_test.go
diff --git a/sexpr/reader.go b/src/sexpr/reader.go
rename from sexpr/reader.go
rename to src/sexpr/reader.go
diff --git a/sexpr/reader_test.go b/src/sexpr/reader_test.go
rename from sexpr/reader_test.go
rename to src/sexpr/reader_test.go
diff --git a/sexpr/token.go b/src/sexpr/token.go
rename from sexpr/token.go
rename to src/sexpr/token.go
diff --git a/sexpr/token_test.go b/src/sexpr/token_test.go
rename from sexpr/token_test.go
rename to src/sexpr/token_test.go
diff --git a/sexpr/value.go b/src/sexpr/value.go
rename from sexpr/value.go
rename to src/sexpr/value.go
diff --git a/stress_test.go b/src/stress_test.go
rename from stress_test.go
rename to src/stress_test.go