Add build tag to omit the x/crypto/ssh dependency#645
Open
espadolini wants to merge 1 commit intopkg:masterfrom
Open
Add build tag to omit the x/crypto/ssh dependency#645espadolini wants to merge 1 commit intopkg:masterfrom
espadolini wants to merge 1 commit intopkg:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The only use of
golang.org/x/crypto/ssh(and, transitively, of any package incrypto/...) is in theNewClientfunction, which is a small wrapper around running a subsystem request with anssh.Clientto then run a sftp client on the channel.For binaries that don't otherwise depend on
x/crypto/ssh(for example utility binaries that only do sftp through stdio) this can be a somewhat significant chunk of binary size; for example a stripped cgoless build ofserver_standalone(darwin arm64, go 1.26.1) goes from 2.9 to 2.0 MiB, which is (relatively) significant.This PR moves
NewClientto a new file which is omitted from the build if a newpkg_sftp.omit_sshbuild tag is set during the build, so users of the library that don't usex/crypto/sshcan omit that dependency.