Skip to content

Use the module path of this fork in the examples - #8

Merged
laodouya merged 2 commits into
developfrom
fix/example-module-path
Nov 6, 2026
Merged

laodouya merged 2 commits into
developfrom
fix/example-module-path

Conversation

@laodouya

@laodouya laodouya commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

The examples under _example still import github.com/mattn/go-sqlite3, which this module does not provide, so they do not build in it: on develop, go build ./_example/simple fails with no required module provides package github.com/mattn/go-sqlite3, and so does every other example. The custom_driver_name Makefile also sets driverName under that path with -X, which the linker silently ignores when no such package is linked.

The first commit replaces the path with github.com/CovenantSQL/go-sqlite3-encrypt everywhere under _example, including the -X flag and the replace directive in the Dockerfile of the simple example. That Dockerfile builds the example in a module of its own that replaces the imported module with the checkout; with only the import changed, go mod tidy there would fetch the latest release of this module from the proxy instead, and the image would no longer test the checkout. The second commit gives the module its own import group in the three examples that listed it among the standard library, as goimports does.

Only examples change; the package itself does not, so CovenantSQL and query results are unaffected.

Left out:

  • The Alpine 3.18 base image of the Dockerfile and the PCRE1 dependency of the mod_regexp C extension (its extension.go builds; the C part needs pcre.h), which are separate updates.
  • The go get github.com/mattn/go-sqlite3 lines in the README: they are in the README of go-sqlite3, which the README of this fork quotes below its own section.
  • .github/workflows/docker.yaml builds the Dockerfile only for tags and for PRs to master, so this PR's checks do not run it; it was built by hand as described below.

Testing

On linux/amd64 (Debian trixie container cql-ci:go1.27), Go 1.27.3, --cpus 4, on develop and on this branch:

  • go build -tags "sqlite_vtable sqlite_trace" ./_example/<dir> for custom_func, hook, json, limit, simple, trace, vtable and vtable_eponymous_only; go build ./_example/fuzz; go build extension.go in mod_regexp and mod_vtable, as their Makefiles do; make in custom_driver_name; go vet of the Go examples. All fail on develop with the missing module and pass on this branch.
  • The custom_driver_name binary built by its Makefile prints my-sqlite3, and the simple binary prints 99 こんにちは世界099.
  • gofmt -l _example and goimports -l _example (x/tools v0.52.0) report nothing; on develop, goimports reports the three files of the second commit.
  • The simple Dockerfile, with its base image pulled through a registry mirror, apk switched to a mirror and ENV GOPROXY=off added so that nothing can come from the module proxy, built and ran as .github/workflows/docker.yaml does: it passes on develop and on this branch, and printed 99 こんにちは世界099; with this branch's examples and develop's Dockerfile, go mod tidy fails, as it looks for github.com/CovenantSQL/go-sqlite3-encrypt in the proxy.

The examples still imported github.com/mattn/go-sqlite3, which this
module does not provide, so they did not build in it: go build
./_example/simple fails with "no required module provides package
github.com/mattn/go-sqlite3". The custom_driver_name Makefile sets
driverName under the same path with -X, which the linker silently
ignores for a package it does not link.

Use github.com/CovenantSQL/go-sqlite3-encrypt in all of them. The
Dockerfile of the simple example builds it in a module of its own that
replaces the imported module with the checkout, so its replace
directive changes with the import; otherwise the image would be built
with the latest release instead of the checkout.
The json, mod_regexp and simple examples listed the module among the
standard library imports, so goimports reported them. The previous
commit changed those import lines, so give the module its own group.
@laodouya
laodouya merged commit fdabe1d into develop Nov 6, 2026
18 checks passed
@laodouya
laodouya deleted the fix/example-module-path branch November 6, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant