activation: allow building without tls support#484
Conversation
When listeners.go APIs are not used by a given application, golang doesn't automatically optimize them out. Add an opt-out build tag to activation/listeners.go, such that one can build an application that uses activation files without the listeners APIs. For applications that do not already include any "crypto/tls" this can be highly beneficial, for example runc can reduce it's total binary size by 7.6%. runc project already uses go mod vendor, and can just delete the listeners.go file: - opencontainers/runc#5056 But it would be preffered if this opt-out build-tag was available here upstream for people to use in general.
Luap99
left a comment
There was a problem hiding this comment.
I am fine with a build tag, but the listeners_test.go should use the same tag so it doesn't fail with the tag.
And I guess it would be nice to documented that tag in the Readme so all library users are aware.
cc @kolyshkin
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| //go:build !no_listeners |
There was a problem hiding this comment.
go build tags are not namespaced so there is always risk that it could conflict when another project uses the same name.
As such I would prefer something more like go_systemd_no_listeners or even coreos_go_systemd_no_listeners
|
Looks like something in the fedora CI tests broke, we need to look into that. Otherwise I guess it would also be nice to add a CI test to make sure the build tag compiles correctly. |
|
We've decided to solve the issue in runc in a different way (see opencontainers/runc#5057), meaning this PR have no users now, thus closing. |
Being fixed by #489 |
When listeners.go APIs are not used by a given application, golang
doesn't automatically optimize them out. Add an opt-out build tag to
activation/listeners.go, such that one can build an application that
uses activation files without the listeners APIs.
For applications that do not already include any "crypto/tls" this can
be highly beneficial, for example runc can reduce it's total binary
size by 7.6%.
runc project already uses go mod vendor, and can just delete the listeners.go file:
But it would be preffered if this opt-out build-tag was available here
upstream for people to use in general.