Skip to content

Add a readium_nocloud build tag leaving out S3 and GCS - #338

Merged
chocolatkey merged 2 commits into
readium:developfrom
ardeshirj:readium-nocloud
Nov 14, 2026
Merged

chocolatkey merged 2 commits into
readium:developfrom
ardeshirj:readium-nocloud

Conversation

@ardeshirj

Copy link
Copy Markdown
Contributor

As discussed with the Readium team, here's the build tag as a PR.

Why: archive, asset, fetcher and util/url contain the S3/GCS support, so importing any of them links the AWS and Google Cloud SDKs and gRPC, even for programs that only read local files or HTTP. With -tags readium_nocloud, the S3/GCS files (archive_*, asset_*, fetcher_* and url_remote.go) and their tests are excluded. HTTP support is unchanged, and default builds are unaffected.

Measured on a program opening an EPUB via streamer.New(streamer.Config{}).Open(ctx, asset.File(u), ""):

  • packages linked: 857 → 330
  • stripped binary: ARMv7 38.5 → 13.2 MB, amd64 40.9 → 13.7 MB
  • peak RSS: 31 → 12 MB

Also: a README "Build tags" section, and a CI step that runs go vet -tags readium_nocloud ./... so the tagged build stays compiling. The s3Resource/gcsResource EfficientStreamer assertions moved from fetcher_http_test.go to fetcher_cloud_test.go so the HTTP tests build with the tag. No CHANGELOG entry, so you can word that yourselves.

Motivation: ShamsaInk, an e-ink EPUB reader on ARMv7, currently strips these files with a script.

🤖 Generated with Claude Code

ardeshirj and others added 2 commits November 13, 2026 00:27
The core packages (archive, asset, fetcher, util/url) hold the S3 and
Google Cloud Storage support, so importing any of them links the AWS and
Google Cloud SDKs and gRPC, even for programs that only read local files
or HTTP. Building with `-tags readium_nocloud` now leaves them out. HTTP
support is unaffected.

Measured on a program opening an EPUB via
streamer.New(streamer.Config{}).Open(ctx, asset.File(u), ""):
- packages linked: 857 -> 330
- stripped binary: ARMv7 38.5 -> 13.2 MB, amd64 40.9 -> 13.7 MB
- peak RSS (VmHWM): 31 -> 12 MB

CI now also runs `go vet -tags readium_nocloud ./...`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chocolatkey

chocolatkey commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

@ardeshirj Thanks for the contribution, it will be merged shortly. FYI If you're looking to reduce the size further, you can run an executable stripper for the appropriate platform, like strip, or using -ldflags="-s -w" in your go build options.

@chocolatkey
chocolatkey merged commit e6f1708 into readium:develop Nov 14, 2026
4 checks passed
ardeshirj added a commit to ardeshirj/shamsaink that referenced this pull request Nov 16, 2026
…r trim retired

Readium merged our build tag (readium/go-toolkit#338) and released it in v0.16.2. Every build takes
-tags blitz,readium_nocloud; reader/nocloud.go stops a build without it. The ARMv7 reader is 25.71 MB
(25.70 with our trim) and links no AWS, Google Cloud or gRPC module. CI no longer makes or caches the
trimmed copy; trim-gotoolkit.sh stays for experiments 02 and 03.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants