elastic / elastic/cloudbeat

DCE (dead code elimination) is disabled

Open
#3,586 9 comments 0 reactions 0 assignees View on GitHub
bug Team:Cloud Security
Dominant language
Go
Stars
58
Forks
55
Avg merge
9h 9m
Merged PRs (30d)
424

Description

**Describe the bug**

DCE (dead code elimination) is being disabled because of problematic use of reflection. This should be a bug for any production binary.

deadcode being included is significantly the binary size and makes it even harder to reduce it.

**Preconditions**

none

**To Reproduce**
1. build the binary (a marker unused method can be added to prove DCE is disabled)

**Expected behavior**

deadcode is not included in the binary

**References**
- https://golab.io/talks/getting-the-most-out-of-dead-code-elimination
- https://github.com/aarzilli/whydeadcode
- https://pkg.go.dev/reflect#Value.MethodByName
> Calling this method will cause the linker to retain all methods with this name in all packages. If the linker can't determine the name, it will retain all exported methods. This may make the executable binary larger but will not affect execution time.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.