Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a noexprlang build tag #629

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add a noexprlang build tag #629

wants to merge 1 commit into from

Conversation

sylr
Copy link

@sylr sylr commented Feb 13, 2025

This module uses github.com/expr-lang/expr which, because of the extensive use of the reflect package, disables go's compiler dead code elimination which can lead to bigger binaries.

This commit adds a noexprlang build tag that allows jsm.go users that do not use expression matching to entirely disable the use of the expr module so that they can benefit from go's dead code elimination if they are eligible to outside jsm.go.

References:

This module uses `github.com/expr-lang/expr` which, because of the
extensive use of the `reflect` package, disables go's compiler dead code
elimination which can lead to bigger binaries.

This commit adds a `noexprlang` build tag that allows jsm.go users that
do not use expression matching to entirely disable the use of the expr
module so that they can benefit from go's dead code elimination if they
are eligible to outside jsm.go.

References:
- https://golab.io/talks/getting-the-most-out-of-dead-code-elimination
- https://github.com/aarzilli/whydeadcode
- spf13/cobra#1956

Signed-off-by: Sylvain Rabot <[email protected]>
@ripienaar
Copy link
Collaborator

curious where you use jsm that this matters a lot @sylr ?

@sylr
Copy link
Author

sylr commented Feb 13, 2025

I use jsm.go to list streams and consumers in order to migrate their leader node on the cluster node that is closest to where I'm writing/consuming.

@ripienaar
Copy link
Collaborator

nats.go now probably does all you need :)

@sylr
Copy link
Author

sylr commented Feb 13, 2025

nats.go now probably does all you need :)

I don't think it allows to StepDown() like jsm does.

@ripienaar
Copy link
Collaborator

Ah, ok, fair enough - yeah its focussed on consumption mainly

am not apposed to this PR so let me know when you're ready for me to take a look

@sylr sylr marked this pull request as ready for review February 18, 2025 09:41
@sylr
Copy link
Author

sylr commented Feb 18, 2025

I think it's pretty much ok right now. Thank you for the review.

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