Kubernetes is a lot of code, plain and simple.
Kubernetes is a lot of code, plain and simple.
Unfortunately, almost every large client library has public methods AND references someone who calls the reflection method somewhere, so in many cases you get the full tree of dependencies.
It’s unfortunate because any one dependency can bring in reflect and trigger the behavior. It hurts large generated method libraries the most since you usually only use a small subset.
See https://go.dev/src/cmd/link/internal/ld/deadcode.go line 318
staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go: if m := reflect.ValueOf(obj).MethodByName("DeepCopyInto"); m.IsValid() && m.Type().NumIn() == 1 && m.Type().NumOut() == 0 && m.Type().In(0) == reflect.TypeOf(obj) {
That's quite the line of code too.
Granted fully featured app will likely use all of the module's code so it's not a factor.