Skip to content

Add gravitational_trace.nocrypto build tag#119

Merged
espadolini merged 4 commits into
masterfrom
espadolini/nocrypto-tag
Apr 7, 2026
Merged

Add gravitational_trace.nocrypto build tag#119
espadolini merged 4 commits into
masterfrom
espadolini/nocrypto-tag

Conversation

@espadolini
Copy link
Copy Markdown
Contributor

This PR adds a build tag to exclude functions from the build that depend on crypto/..., which, for programs that don't otherwise import anything else from crypto, can lead to significant reduction in code size (I've seen a 25% - from 4.3 to 3.2 MB - for a small utility program used in Teleport).

There doesn't seem to be any strong convention around how to name build tags that are intended for users of libraries; kubernetes-sigs/kustomize uses kustomize_disable_go_plugin_support, grpc-go has grpcnotrace, the go standard library itself uses netgo, osusergo and nethttpomithttp2; I don't think we should "namespace" build tags here with just a trace prefix, so I picked gravitational_trace, and using a dot made more sense to me than just concatenating strings, but I don't have strong feelings either way.

with:
go-version-file: go.mod
- name: Check dependencies with the nocrypto build tag
run: "go list -tags gravitational_trace.nocrypto -deps ./... | sort | tee /dev/stderr | (! grep -q -e ^crypto$ -e ^crypto/ )"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't used goda because I'm not sure of which version of go that would require, and using go list is good enough for this specific purpose.

rosstimothy
rosstimothy previously approved these changes Apr 6, 2026
Comment thread internal/traverse.go
Comment thread trace_crypto_test.go
Comment thread trace_crypto_test.go
Comment thread errors_nocrypto.go
Base automatically changed from tross/dead_code to master April 7, 2026 12:22
@espadolini espadolini dismissed rosstimothy’s stale review April 7, 2026 12:22

The base branch was changed.

@espadolini espadolini merged commit 3d9f202 into master Apr 7, 2026
6 checks passed
@espadolini espadolini deleted the espadolini/nocrypto-tag branch April 7, 2026 14:45
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.

3 participants